@@ -23,8 +23,8 @@ discard block |
||
| 23 | 23 | * @credit Jan Keller Pedersen <[email protected]> - IDG Danmark A/S <www.idg.dk> |
| 24 | 24 | * @link http://smartfactory.ca The SmartFactory |
| 25 | 25 | */ |
| 26 | -include_once XOOPS_ROOT_PATH . '/modules/smartobject/class/smartobject.php'; |
|
| 27 | -include_once XOOPS_ROOT_PATH . '/modules/smartobject/class/smartobjecthandler.php'; |
|
| 26 | +include_once XOOPS_ROOT_PATH.'/modules/smartobject/class/smartobject.php'; |
|
| 27 | +include_once XOOPS_ROOT_PATH.'/modules/smartobject/class/smartobjecthandler.php'; |
|
| 28 | 28 | |
| 29 | 29 | /** |
| 30 | 30 | * Class SmartObjectController |
@@ -50,15 +50,15 @@ discard block |
||
| 50 | 50 | foreach (array_keys($smartObj->vars) as $key) { |
| 51 | 51 | switch ($smartObj->vars[$key]['data_type']) { |
| 52 | 52 | case XOBJ_DTYPE_IMAGE: |
| 53 | - if (isset($_POST['url_' . $key]) && $_POST['url_' . $key] !== '') { |
|
| 54 | - $oldFile = $smartObj->getUploadDir(true) . $smartObj->getVar($key, 'e'); |
|
| 55 | - $smartObj->setVar($key, $_POST['url_' . $key]); |
|
| 53 | + if (isset($_POST['url_'.$key]) && $_POST['url_'.$key] !== '') { |
|
| 54 | + $oldFile = $smartObj->getUploadDir(true).$smartObj->getVar($key, 'e'); |
|
| 55 | + $smartObj->setVar($key, $_POST['url_'.$key]); |
|
| 56 | 56 | if (file_exists($oldFile)) { |
| 57 | 57 | unlink($oldFile); |
| 58 | 58 | } |
| 59 | 59 | } |
| 60 | - if (isset($_POST['delete_' . $key]) && $_POST['delete_' . $key] == '1') { |
|
| 61 | - $oldFile = $smartObj->getUploadDir(true) . $smartObj->getVar($key, 'e'); |
|
| 60 | + if (isset($_POST['delete_'.$key]) && $_POST['delete_'.$key] == '1') { |
|
| 61 | + $oldFile = $smartObj->getUploadDir(true).$smartObj->getVar($key, 'e'); |
|
| 62 | 62 | $smartObj->setVar($key, ''); |
| 63 | 63 | if (file_exists($oldFile)) { |
| 64 | 64 | unlink($oldFile); |
@@ -68,10 +68,10 @@ discard block |
||
| 68 | 68 | |
| 69 | 69 | case XOBJ_DTYPE_URLLINK: |
| 70 | 70 | $linkObj = $smartObj->getUrlLinkObj($key); |
| 71 | - $linkObj->setVar('caption', $_POST['caption_' . $key]); |
|
| 72 | - $linkObj->setVar('description', $_POST['desc_' . $key]); |
|
| 73 | - $linkObj->setVar('target', $_POST['target_' . $key]); |
|
| 74 | - $linkObj->setVar('url', $_POST['url_' . $key]); |
|
| 71 | + $linkObj->setVar('caption', $_POST['caption_'.$key]); |
|
| 72 | + $linkObj->setVar('description', $_POST['desc_'.$key]); |
|
| 73 | + $linkObj->setVar('target', $_POST['target_'.$key]); |
|
| 74 | + $linkObj->setVar('url', $_POST['url_'.$key]); |
|
| 75 | 75 | if ($linkObj->getVar('url') !== '') { |
| 76 | 76 | $smartObj->storeUrlLinkObj($linkObj); |
| 77 | 77 | } |
@@ -80,11 +80,11 @@ discard block |
||
| 80 | 80 | break; |
| 81 | 81 | |
| 82 | 82 | case XOBJ_DTYPE_FILE: |
| 83 | - if (!isset($_FILES['upload_' . $key]['name']) || $_FILES['upload_' . $key]['name'] === '') { |
|
| 83 | + if (!isset($_FILES['upload_'.$key]['name']) || $_FILES['upload_'.$key]['name'] === '') { |
|
| 84 | 84 | $fileObj = $smartObj->getFileObj($key); |
| 85 | - $fileObj->setVar('caption', $_POST['caption_' . $key]); |
|
| 86 | - $fileObj->setVar('description', $_POST['desc_' . $key]); |
|
| 87 | - $fileObj->setVar('url', $_POST['url_' . $key]); |
|
| 85 | + $fileObj->setVar('caption', $_POST['caption_'.$key]); |
|
| 86 | + $fileObj->setVar('description', $_POST['desc_'.$key]); |
|
| 87 | + $fileObj->setVar('url', $_POST['url_'.$key]); |
|
| 88 | 88 | if (!($fileObj->getVar('url') === '' && $fileObj->getVar('url') === '' && $fileObj->getVar('url') === '')) { |
| 89 | 89 | $res = $smartObj->storeFileObj($fileObj); |
| 90 | 90 | if ($res) { |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | $value = strtotime($_POST[$key]); |
| 108 | 108 | //if strtotime returns false, the value is already a time stamp |
| 109 | 109 | if (!$value) { |
| 110 | - $value = (int)$_POST[$key]; |
|
| 110 | + $value = (int) $_POST[$key]; |
|
| 111 | 111 | } |
| 112 | 112 | } |
| 113 | 113 | $smartObj->setVar($key, $value); |
@@ -144,12 +144,12 @@ discard block |
||
| 144 | 144 | |
| 145 | 145 | // Check if there were uploaded files |
| 146 | 146 | if (isset($_POST['smart_upload_image']) || isset($_POST['smart_upload_file'])) { |
| 147 | - include_once XOOPS_ROOT_PATH . '/modules/smartobject/class/smartuploader.php'; |
|
| 147 | + include_once XOOPS_ROOT_PATH.'/modules/smartobject/class/smartuploader.php'; |
|
| 148 | 148 | $uploaderObj = new SmartUploader($smartObj->getImageDir(true), $this->handler->_allowedMimeTypes, $this->handler->_maxFileSize, $this->handler->_maxWidth, $this->handler->_maxHeight); |
| 149 | 149 | foreach ($_FILES as $name => $file_array) { |
| 150 | 150 | if (isset($file_array['name']) && $file_array['name'] !== '' && in_array(str_replace('upload_', '', $name), array_keys($smartObj->vars))) { |
| 151 | 151 | if ($uploaderObj->fetchMedia($name)) { |
| 152 | - $uploaderObj->setTargetFileName(time() . '_' . $uploaderObj->getMediaName()); |
|
| 152 | + $uploaderObj->setTargetFileName(time().'_'.$uploaderObj->getMediaName()); |
|
| 153 | 153 | if ($uploaderObj->upload()) { |
| 154 | 154 | // Find the related field in the SmartObject |
| 155 | 155 | $related_field = str_replace('upload_', '', $name); |
@@ -158,14 +158,14 @@ discard block |
||
| 158 | 158 | if ($smartObj->vars[$related_field]['data_type'] === XOBJ_DTYPE_FILE) { |
| 159 | 159 | $object_fileurl = $smartObj->getUploadDir(); |
| 160 | 160 | $fileObj = $smartObj->getFileObj($related_field); |
| 161 | - $fileObj->setVar('url', $object_fileurl . $uploaderObj->getSavedFileName()); |
|
| 162 | - $fileObj->setVar('caption', $_POST['caption_' . $related_field]); |
|
| 163 | - $fileObj->setVar('description', $_POST['desc_' . $related_field]); |
|
| 161 | + $fileObj->setVar('url', $object_fileurl.$uploaderObj->getSavedFileName()); |
|
| 162 | + $fileObj->setVar('caption', $_POST['caption_'.$related_field]); |
|
| 163 | + $fileObj->setVar('description', $_POST['desc_'.$related_field]); |
|
| 164 | 164 | $smartObj->storeFileObj($fileObj); |
| 165 | 165 | //todo: catch errors |
| 166 | 166 | $smartObj->setVar($related_field, $fileObj->getVar('fileid')); |
| 167 | 167 | } else { |
| 168 | - $old_file = $smartObj->getUploadDir(true) . $smartObj->getVar($related_field); |
|
| 168 | + $old_file = $smartObj->getUploadDir(true).$smartObj->getVar($related_field); |
|
| 169 | 169 | unlink($old_file); |
| 170 | 170 | $smartObj->setVar($related_field, $uploaderObj->getSavedFileName()); |
| 171 | 171 | } |
@@ -196,7 +196,7 @@ discard block |
||
| 196 | 196 | return $smartObj; |
| 197 | 197 | } else { |
| 198 | 198 | if (!$storeResult) { |
| 199 | - redirect_header($smart_previous_page, 3, _CO_SOBJECT_SAVE_ERROR . $smartObj->getHtmlErrors()); |
|
| 199 | + redirect_header($smart_previous_page, 3, _CO_SOBJECT_SAVE_ERROR.$smartObj->getHtmlErrors()); |
|
| 200 | 200 | } |
| 201 | 201 | |
| 202 | 202 | $redirect_page = $redirect_page ?: smart_get_page_before_form(); |
@@ -220,7 +220,7 @@ discard block |
||
| 220 | 220 | */ |
| 221 | 221 | public function storeFromDefaultForm($created_success_msg, $modified_success_msg, $redirect_page = false, $debug = false, $x_param = false) |
| 222 | 222 | { |
| 223 | - $objectid = isset($_POST[$this->handler->keyName]) ? (int)$_POST[$this->handler->keyName] : 0; |
|
| 223 | + $objectid = isset($_POST[$this->handler->keyName]) ? (int) $_POST[$this->handler->keyName] : 0; |
|
| 224 | 224 | if ($debug) { |
| 225 | 225 | if ($x_param) { |
| 226 | 226 | $smartObj = $this->handler->getD($objectid, true, $x_param); |
@@ -296,7 +296,7 @@ discard block |
||
| 296 | 296 | { |
| 297 | 297 | global $smart_previous_page; |
| 298 | 298 | |
| 299 | - $objectid = isset($_REQUEST[$this->handler->keyName]) ? (int)$_REQUEST[$this->handler->keyName] : 0; |
|
| 299 | + $objectid = isset($_REQUEST[$this->handler->keyName]) ? (int) $_REQUEST[$this->handler->keyName] : 0; |
|
| 300 | 300 | $smartObj = $this->handler->get($objectid); |
| 301 | 301 | |
| 302 | 302 | if ($smartObj->isNew()) { |
@@ -306,7 +306,7 @@ discard block |
||
| 306 | 306 | $confirm = isset($_POST['confirm']) ? $_POST['confirm'] : 0; |
| 307 | 307 | if ($confirm) { |
| 308 | 308 | if (!$this->handler->delete($smartObj)) { |
| 309 | - redirect_header($_POST['redirect_page'], 3, _CO_SOBJECT_DELETE_ERROR . $smartObj->getHtmlErrors()); |
|
| 309 | + redirect_header($_POST['redirect_page'], 3, _CO_SOBJECT_DELETE_ERROR.$smartObj->getHtmlErrors()); |
|
| 310 | 310 | exit; |
| 311 | 311 | } |
| 312 | 312 | |
@@ -336,7 +336,7 @@ discard block |
||
| 336 | 336 | { |
| 337 | 337 | global $smart_previous_page, $xoopsTpl; |
| 338 | 338 | |
| 339 | - $objectid = isset($_REQUEST[$this->handler->keyName]) ? (int)$_REQUEST[$this->handler->keyName] : 0; |
|
| 339 | + $objectid = isset($_REQUEST[$this->handler->keyName]) ? (int) $_REQUEST[$this->handler->keyName] : 0; |
|
| 340 | 340 | $smartObj = $this->handler->get($objectid); |
| 341 | 341 | |
| 342 | 342 | if ($smartObj->isNew()) { |
@@ -346,7 +346,7 @@ discard block |
||
| 346 | 346 | $confirm = isset($_POST['confirm']) ? $_POST['confirm'] : 0; |
| 347 | 347 | if ($confirm) { |
| 348 | 348 | if (!$this->handler->delete($smartObj)) { |
| 349 | - redirect_header($_POST['redirect_page'], 3, _CO_SOBJECT_DELETE_ERROR . $smartObj->getHtmlErrors()); |
|
| 349 | + redirect_header($_POST['redirect_page'], 3, _CO_SOBJECT_DELETE_ERROR.$smartObj->getHtmlErrors()); |
|
| 350 | 350 | exit; |
| 351 | 351 | } |
| 352 | 352 | |
@@ -375,22 +375,22 @@ discard block |
||
| 375 | 375 | */ |
| 376 | 376 | public function getAdminViewItemLink(SmartObject $smartObj, $onlyUrl = false, $withimage = false) |
| 377 | 377 | { |
| 378 | - $ret = $this->handler->_moduleUrl . 'admin/' . $this->handler->_page . '?op=view&' . $this->handler->keyName . '=' . $smartObj->getVar($this->handler->keyName); |
|
| 378 | + $ret = $this->handler->_moduleUrl.'admin/'.$this->handler->_page.'?op=view&'.$this->handler->keyName.'='.$smartObj->getVar($this->handler->keyName); |
|
| 379 | 379 | if ($onlyUrl) { |
| 380 | 380 | return $ret; |
| 381 | 381 | } elseif ($withimage) { |
| 382 | - return "<a href='" . |
|
| 383 | - $ret . |
|
| 384 | - "'><img src='" . |
|
| 385 | - SMARTOBJECT_IMAGES_ACTIONS_URL . |
|
| 386 | - "viewmag.png' style='vertical-align: middle;' alt='" . |
|
| 387 | - _CO_SOBJECT_ADMIN_VIEW . |
|
| 388 | - "' title='" . |
|
| 389 | - _CO_SOBJECT_ADMIN_VIEW . |
|
| 382 | + return "<a href='". |
|
| 383 | + $ret. |
|
| 384 | + "'><img src='". |
|
| 385 | + SMARTOBJECT_IMAGES_ACTIONS_URL. |
|
| 386 | + "viewmag.png' style='vertical-align: middle;' alt='". |
|
| 387 | + _CO_SOBJECT_ADMIN_VIEW. |
|
| 388 | + "' title='". |
|
| 389 | + _CO_SOBJECT_ADMIN_VIEW. |
|
| 390 | 390 | "'/></a>"; |
| 391 | 391 | } |
| 392 | 392 | |
| 393 | - return "<a href='" . $ret . "'>" . $smartObj->getVar($this->handler->identifierName) . '</a>'; |
|
| 393 | + return "<a href='".$ret."'>".$smartObj->getVar($this->handler->identifierName).'</a>'; |
|
| 394 | 394 | } |
| 395 | 395 | |
| 396 | 396 | /** |
@@ -412,31 +412,31 @@ discard block |
||
| 412 | 412 | $seoIncludeId = true; |
| 413 | 413 | |
| 414 | 414 | if ($seoMode === 'rewrite') { |
| 415 | - $ret = XOOPS_URL . |
|
| 416 | - '/' . |
|
| 417 | - $seoModuleName . |
|
| 418 | - '.' . |
|
| 419 | - $this->handler->_itemname . |
|
| 420 | - ($seoIncludeId ? '.' . $smartObj->getVar($this->handler->keyName) : '') . |
|
| 421 | - '/' . |
|
| 422 | - $smartObj->getVar('short_url') . |
|
| 415 | + $ret = XOOPS_URL. |
|
| 416 | + '/'. |
|
| 417 | + $seoModuleName. |
|
| 418 | + '.'. |
|
| 419 | + $this->handler->_itemname. |
|
| 420 | + ($seoIncludeId ? '.'.$smartObj->getVar($this->handler->keyName) : ''). |
|
| 421 | + '/'. |
|
| 422 | + $smartObj->getVar('short_url'). |
|
| 423 | 423 | '.html'; |
| 424 | 424 | } elseif ($seoMode === 'pathinfo') { |
| 425 | - $ret = SMARTOBJECT_URL . |
|
| 426 | - 'seo.php/' . |
|
| 427 | - $seoModuleName . |
|
| 428 | - '.' . |
|
| 429 | - $this->handler->_itemname . |
|
| 430 | - ($seoIncludeId ? '.' . $smartObj->getVar($this->handler->keyName) : '') . |
|
| 431 | - '/' . |
|
| 432 | - $smartObj->getVar('short_url') . |
|
| 425 | + $ret = SMARTOBJECT_URL. |
|
| 426 | + 'seo.php/'. |
|
| 427 | + $seoModuleName. |
|
| 428 | + '.'. |
|
| 429 | + $this->handler->_itemname. |
|
| 430 | + ($seoIncludeId ? '.'.$smartObj->getVar($this->handler->keyName) : ''). |
|
| 431 | + '/'. |
|
| 432 | + $smartObj->getVar('short_url'). |
|
| 433 | 433 | '.html'; |
| 434 | 434 | } else { |
| 435 | - $ret = $this->handler->_moduleUrl . $this->handler->_page . '?' . $this->handler->keyName . '=' . $smartObj->getVar($this->handler->keyName); |
|
| 435 | + $ret = $this->handler->_moduleUrl.$this->handler->_page.'?'.$this->handler->keyName.'='.$smartObj->getVar($this->handler->keyName); |
|
| 436 | 436 | } |
| 437 | 437 | |
| 438 | 438 | if (!$onlyUrl) { |
| 439 | - $ret = "<a href='" . $ret . "'>" . $smartObj->getVar($this->handler->identifierName) . '</a>'; |
|
| 439 | + $ret = "<a href='".$ret."'>".$smartObj->getVar($this->handler->identifierName).'</a>'; |
|
| 440 | 440 | } |
| 441 | 441 | |
| 442 | 442 | return $ret; |
@@ -450,30 +450,30 @@ discard block |
||
| 450 | 450 | */ |
| 451 | 451 | public function getEditLanguageLink($smartObj, $onlyUrl = false, $withimage = true) |
| 452 | 452 | { |
| 453 | - $ret = $this->handler->_moduleUrl . |
|
| 454 | - 'admin/' . |
|
| 455 | - $this->handler->_page . |
|
| 456 | - '?op=mod&' . |
|
| 457 | - $this->handler->keyName . |
|
| 458 | - '=' . |
|
| 459 | - $smartObj->getVar($this->handler->keyName) . |
|
| 460 | - '&language=' . |
|
| 453 | + $ret = $this->handler->_moduleUrl. |
|
| 454 | + 'admin/'. |
|
| 455 | + $this->handler->_page. |
|
| 456 | + '?op=mod&'. |
|
| 457 | + $this->handler->keyName. |
|
| 458 | + '='. |
|
| 459 | + $smartObj->getVar($this->handler->keyName). |
|
| 460 | + '&language='. |
|
| 461 | 461 | $smartObj->getVar('language'); |
| 462 | 462 | if ($onlyUrl) { |
| 463 | 463 | return $ret; |
| 464 | 464 | } elseif ($withimage) { |
| 465 | - return "<a href='" . |
|
| 466 | - $ret . |
|
| 467 | - "'><img src='" . |
|
| 468 | - SMARTOBJECT_IMAGES_ACTIONS_URL . |
|
| 469 | - "wizard.png' style='vertical-align: middle;' alt='" . |
|
| 470 | - _CO_SOBJECT_LANGUAGE_MODIFY . |
|
| 471 | - "' title='" . |
|
| 472 | - _CO_SOBJECT_LANGUAGE_MODIFY . |
|
| 465 | + return "<a href='". |
|
| 466 | + $ret. |
|
| 467 | + "'><img src='". |
|
| 468 | + SMARTOBJECT_IMAGES_ACTIONS_URL. |
|
| 469 | + "wizard.png' style='vertical-align: middle;' alt='". |
|
| 470 | + _CO_SOBJECT_LANGUAGE_MODIFY. |
|
| 471 | + "' title='". |
|
| 472 | + _CO_SOBJECT_LANGUAGE_MODIFY. |
|
| 473 | 473 | "'/></a>"; |
| 474 | 474 | } |
| 475 | 475 | |
| 476 | - return "<a href='" . $ret . "'>" . $smartObj->getVar($this->handler->identifierName) . '</a>'; |
|
| 476 | + return "<a href='".$ret."'>".$smartObj->getVar($this->handler->identifierName).'</a>'; |
|
| 477 | 477 | } |
| 478 | 478 | |
| 479 | 479 | /** |
@@ -486,22 +486,22 @@ discard block |
||
| 486 | 486 | public function getEditItemLink($smartObj, $onlyUrl = false, $withimage = true, $userSide = false) |
| 487 | 487 | { |
| 488 | 488 | $admin_side = $userSide ? '' : 'admin/'; |
| 489 | - $ret = $this->handler->_moduleUrl . $admin_side . $this->handler->_page . '?op=mod&' . $this->handler->keyName . '=' . $smartObj->getVar($this->handler->keyName); |
|
| 489 | + $ret = $this->handler->_moduleUrl.$admin_side.$this->handler->_page.'?op=mod&'.$this->handler->keyName.'='.$smartObj->getVar($this->handler->keyName); |
|
| 490 | 490 | if ($onlyUrl) { |
| 491 | 491 | return $ret; |
| 492 | 492 | } elseif ($withimage) { |
| 493 | - return "<a href='" . |
|
| 494 | - $ret . |
|
| 495 | - "'><img src='" . |
|
| 496 | - SMARTOBJECT_IMAGES_ACTIONS_URL . |
|
| 497 | - "edit.png' style='vertical-align: middle;' alt='" . |
|
| 498 | - _CO_SOBJECT_MODIFY . |
|
| 499 | - "' title='" . |
|
| 500 | - _CO_SOBJECT_MODIFY . |
|
| 493 | + return "<a href='". |
|
| 494 | + $ret. |
|
| 495 | + "'><img src='". |
|
| 496 | + SMARTOBJECT_IMAGES_ACTIONS_URL. |
|
| 497 | + "edit.png' style='vertical-align: middle;' alt='". |
|
| 498 | + _CO_SOBJECT_MODIFY. |
|
| 499 | + "' title='". |
|
| 500 | + _CO_SOBJECT_MODIFY. |
|
| 501 | 501 | "'/></a>"; |
| 502 | 502 | } |
| 503 | 503 | |
| 504 | - return "<a href='" . $ret . "'>" . $smartObj->getVar($this->handler->identifierName) . '</a>'; |
|
| 504 | + return "<a href='".$ret."'>".$smartObj->getVar($this->handler->identifierName).'</a>'; |
|
| 505 | 505 | } |
| 506 | 506 | |
| 507 | 507 | /** |
@@ -514,22 +514,22 @@ discard block |
||
| 514 | 514 | public function getDeleteItemLink($smartObj, $onlyUrl = false, $withimage = true, $userSide = false) |
| 515 | 515 | { |
| 516 | 516 | $admin_side = $userSide ? '' : 'admin/'; |
| 517 | - $ret = $this->handler->_moduleUrl . $admin_side . $this->handler->_page . '?op=del&' . $this->handler->keyName . '=' . $smartObj->getVar($this->handler->keyName); |
|
| 517 | + $ret = $this->handler->_moduleUrl.$admin_side.$this->handler->_page.'?op=del&'.$this->handler->keyName.'='.$smartObj->getVar($this->handler->keyName); |
|
| 518 | 518 | if ($onlyUrl) { |
| 519 | 519 | return $ret; |
| 520 | 520 | } elseif ($withimage) { |
| 521 | - return "<a href='" . |
|
| 522 | - $ret . |
|
| 523 | - "'><img src='" . |
|
| 524 | - SMARTOBJECT_IMAGES_ACTIONS_URL . |
|
| 525 | - "editdelete.png' style='vertical-align: middle;' alt='" . |
|
| 526 | - _CO_SOBJECT_DELETE . |
|
| 527 | - "' title='" . |
|
| 528 | - _CO_SOBJECT_DELETE . |
|
| 521 | + return "<a href='". |
|
| 522 | + $ret. |
|
| 523 | + "'><img src='". |
|
| 524 | + SMARTOBJECT_IMAGES_ACTIONS_URL. |
|
| 525 | + "editdelete.png' style='vertical-align: middle;' alt='". |
|
| 526 | + _CO_SOBJECT_DELETE. |
|
| 527 | + "' title='". |
|
| 528 | + _CO_SOBJECT_DELETE. |
|
| 529 | 529 | "'/></a>"; |
| 530 | 530 | } |
| 531 | 531 | |
| 532 | - return "<a href='" . $ret . "'>" . $smartObj->getVar($this->handler->identifierName) . '</a>'; |
|
| 532 | + return "<a href='".$ret."'>".$smartObj->getVar($this->handler->identifierName).'</a>'; |
|
| 533 | 533 | } |
| 534 | 534 | |
| 535 | 535 | /** |
@@ -540,28 +540,28 @@ discard block |
||
| 540 | 540 | { |
| 541 | 541 | global $xoopsConfig; |
| 542 | 542 | |
| 543 | - $printlink = $this->handler->_moduleUrl . 'print.php?' . $this->handler->keyName . '=' . $smartObj->getVar($this->handler->keyName); |
|
| 544 | - $js = "javascript:openWithSelfMain('" . $printlink . "', 'smartpopup', 700, 519);"; |
|
| 545 | - $printlink = '<a href="' . $js . '"><img src="' . SMARTOBJECT_IMAGES_ACTIONS_URL . 'fileprint.png" alt="" style="vertical-align: middle;"/></a>'; |
|
| 543 | + $printlink = $this->handler->_moduleUrl.'print.php?'.$this->handler->keyName.'='.$smartObj->getVar($this->handler->keyName); |
|
| 544 | + $js = "javascript:openWithSelfMain('".$printlink."', 'smartpopup', 700, 519);"; |
|
| 545 | + $printlink = '<a href="'.$js.'"><img src="'.SMARTOBJECT_IMAGES_ACTIONS_URL.'fileprint.png" alt="" style="vertical-align: middle;"/></a>'; |
|
| 546 | 546 | |
| 547 | 547 | $smartModule = smart_getModuleInfo($smartObj->handler->_moduleName); |
| 548 | 548 | $link = smart_getCurrentPage(); |
| 549 | 549 | $mid = $smartModule->getVar('mid'); |
| 550 | - $friendlink = "<a href=\"javascript:openWithSelfMain('" . |
|
| 551 | - SMARTOBJECT_URL . |
|
| 552 | - 'sendlink.php?link=' . |
|
| 553 | - $link . |
|
| 554 | - '&mid=' . |
|
| 555 | - $mid . |
|
| 556 | - "', ',',',',',','sendmessage', 674, 500);\"><img src=\"" . |
|
| 557 | - SMARTOBJECT_IMAGES_ACTIONS_URL . |
|
| 558 | - "mail_send.png\" alt=\"" . |
|
| 559 | - _CO_SOBJECT_EMAIL . |
|
| 560 | - "\" title=\"" . |
|
| 561 | - _CO_SOBJECT_EMAIL . |
|
| 550 | + $friendlink = "<a href=\"javascript:openWithSelfMain('". |
|
| 551 | + SMARTOBJECT_URL. |
|
| 552 | + 'sendlink.php?link='. |
|
| 553 | + $link. |
|
| 554 | + '&mid='. |
|
| 555 | + $mid. |
|
| 556 | + "', ',',',',',','sendmessage', 674, 500);\"><img src=\"". |
|
| 557 | + SMARTOBJECT_IMAGES_ACTIONS_URL. |
|
| 558 | + "mail_send.png\" alt=\"". |
|
| 559 | + _CO_SOBJECT_EMAIL. |
|
| 560 | + "\" title=\"". |
|
| 561 | + _CO_SOBJECT_EMAIL. |
|
| 562 | 562 | "\" style=\"vertical-align: middle;\"/></a>"; |
| 563 | 563 | |
| 564 | - $ret = '<span id="smartobject_print_button">' . $printlink . ' </span>' . '<span id="smartobject_mail_button">' . $friendlink . '</span>'; |
|
| 564 | + $ret = '<span id="smartobject_print_button">'.$printlink.' </span>'.'<span id="smartobject_mail_button">'.$friendlink.'</span>'; |
|
| 565 | 565 | |
| 566 | 566 | return $ret; |
| 567 | 567 | } |
@@ -571,7 +571,7 @@ discard block |
||
| 571 | 571 | */ |
| 572 | 572 | public function getModuleItemString() |
| 573 | 573 | { |
| 574 | - $ret = $this->handler->_moduleName . '_' . $this->handler->_itemname; |
|
| 574 | + $ret = $this->handler->_moduleName.'_'.$this->handler->_itemname; |
|
| 575 | 575 | |
| 576 | 576 | return $ret; |
| 577 | 577 | } |
@@ -29,8 +29,8 @@ discard block |
||
| 29 | 29 | |
| 30 | 30 | // defined('XOOPS_ROOT_PATH') || exit('XOOPS root path not defined'); |
| 31 | 31 | |
| 32 | -include_once XOOPS_ROOT_PATH . '/modules/smartobject/class/smartobject.php'; |
|
| 33 | -include_once XOOPS_ROOT_PATH . '/modules/smartobject/class/smartplugins.php'; |
|
| 32 | +include_once XOOPS_ROOT_PATH.'/modules/smartobject/class/smartobject.php'; |
|
| 33 | +include_once XOOPS_ROOT_PATH.'/modules/smartobject/class/smartplugins.php'; |
|
| 34 | 34 | |
| 35 | 35 | /** |
| 36 | 36 | * Class SmartobjectRating |
@@ -124,14 +124,14 @@ discard block |
||
| 124 | 124 | */ |
| 125 | 125 | public function getItemValue() |
| 126 | 126 | { |
| 127 | - $moduleUrl = XOOPS_URL . '/modules/' . $this->getVar('dirname', 'n') . '/'; |
|
| 127 | + $moduleUrl = XOOPS_URL.'/modules/'.$this->getVar('dirname', 'n').'/'; |
|
| 128 | 128 | $plugin = $this->getModulePlugin(); |
| 129 | 129 | $pluginItemInfo = $plugin->getItemInfo($this->getVar('item')); |
| 130 | 130 | if (!$pluginItemInfo) { |
| 131 | 131 | return ''; |
| 132 | 132 | } |
| 133 | 133 | $itemPath = sprintf($pluginItemInfo['url'], $this->getVar('itemid')); |
| 134 | - $ret = '<a href="' . $moduleUrl . $itemPath . '">' . $pluginItemInfo['caption'] . '</a>'; |
|
| 134 | + $ret = '<a href="'.$moduleUrl.$itemPath.'">'.$pluginItemInfo['caption'].'</a>'; |
|
| 135 | 135 | |
| 136 | 136 | return $ret; |
| 137 | 137 | } |
@@ -174,7 +174,7 @@ discard block |
||
| 174 | 174 | public function __construct(XoopsDatabase $db) |
| 175 | 175 | { |
| 176 | 176 | parent::__construct($db, 'rating', 'ratingid', 'rate', '', 'smartobject'); |
| 177 | - $this->generalSQL = 'SELECT * FROM ' . $this->table . ' AS ' . $this->_itemname . ' INNER JOIN ' . $this->db->prefix('users') . ' AS user ON ' . $this->_itemname . '.uid=user.uid'; |
|
| 177 | + $this->generalSQL = 'SELECT * FROM '.$this->table.' AS '.$this->_itemname.' INNER JOIN '.$this->db->prefix('users').' AS user ON '.$this->_itemname.'.uid=user.uid'; |
|
| 178 | 178 | |
| 179 | 179 | $this->_rateOptions[1] = 1; |
| 180 | 180 | $this->_rateOptions[2] = 2; |
@@ -217,7 +217,7 @@ discard block |
||
| 217 | 217 | */ |
| 218 | 218 | public function getRatingAverageByItemId($itemid, $dirname, $item) |
| 219 | 219 | { |
| 220 | - $sql = 'SELECT AVG(rate), COUNT(ratingid) FROM ' . $this->table . " WHERE itemid=$itemid AND dirname='$dirname' AND item='$item' GROUP BY itemid"; |
|
| 220 | + $sql = 'SELECT AVG(rate), COUNT(ratingid) FROM '.$this->table." WHERE itemid=$itemid AND dirname='$dirname' AND item='$item' GROUP BY itemid"; |
|
| 221 | 221 | $result = $this->db->query($sql); |
| 222 | 222 | if (!$result) { |
| 223 | 223 | return 0; |
@@ -1,7 +1,7 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | // defined('XOOPS_ROOT_PATH') || exit('XOOPS root path not defined'); |
| 3 | 3 | |
| 4 | -include_once XOOPS_ROOT_PATH . '/modules/smartobject/class/basedurl.php'; |
|
| 4 | +include_once XOOPS_ROOT_PATH.'/modules/smartobject/class/basedurl.php'; |
|
| 5 | 5 | |
| 6 | 6 | /** |
| 7 | 7 | * Class SmartobjectUrlLink |
@@ -78,10 +78,10 @@ discard block |
||
| 78 | 78 | if ($this->singlewords) { |
| 79 | 79 | $keywords = explode(' ', $this->preg_keywords); |
| 80 | 80 | foreach ($keywords as $keyword) { |
| 81 | - $patterns[] = '/(?' . '>' . $keyword . '+)/si'; |
|
| 81 | + $patterns[] = '/(?'.'>'.$keyword.'+)/si'; |
|
| 82 | 82 | } |
| 83 | 83 | } else { |
| 84 | - $patterns[] = '/(?' . '>' . $this->preg_keywords . '+)/si'; |
|
| 84 | + $patterns[] = '/(?'.'>'.$this->preg_keywords.'+)/si'; |
|
| 85 | 85 | } |
| 86 | 86 | |
| 87 | 87 | $result = $replace_matches[0]; |
@@ -104,9 +104,9 @@ discard block |
||
| 104 | 104 | */ |
| 105 | 105 | public function highlight($buffer) |
| 106 | 106 | { |
| 107 | - $buffer = '>' . $buffer . '<'; |
|
| 107 | + $buffer = '>'.$buffer.'<'; |
|
| 108 | 108 | $this->preg_keywords = preg_replace('/[^\w ]/si', '', $this->keywords); |
| 109 | - $buffer = preg_replace_callback("/(\>(((?" . ">[^><]+)|(?R))*)\<)/is", array(&$this, 'replace'), $buffer); |
|
| 109 | + $buffer = preg_replace_callback("/(\>(((?".">[^><]+)|(?R))*)\<)/is", array(&$this, 'replace'), $buffer); |
|
| 110 | 110 | $buffer = substr($buffer, 1, -1); |
| 111 | 111 | |
| 112 | 112 | return $buffer; |
@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | */ |
| 12 | 12 | |
| 13 | 13 | // defined('XOOPS_ROOT_PATH') || exit('XOOPS root path not defined'); |
| 14 | -include_once XOOPS_ROOT_PATH . '/modules/smartobject/class/smartseoobject.php'; |
|
| 14 | +include_once XOOPS_ROOT_PATH.'/modules/smartobject/class/smartseoobject.php'; |
|
| 15 | 15 | |
| 16 | 16 | /** |
| 17 | 17 | * Class SmartobjectCategory |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | global $myts; |
| 96 | 96 | $objectArray = parent::toArray(); |
| 97 | 97 | if ($objectArray['image']) { |
| 98 | - $objectArray['image'] = $this->getImageDir() . $objectArray['image']; |
|
| 98 | + $objectArray['image'] = $this->getImageDir().$objectArray['image']; |
|
| 99 | 99 | } |
| 100 | 100 | |
| 101 | 101 | return $objectArray; |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | */ |
| 112 | 112 | public function getCategoryPath($withAllLink = true, $currentCategory = false) |
| 113 | 113 | { |
| 114 | - include_once SMARTOBJECT_ROOT_PATH . 'class/smartobjectcontroller.php'; |
|
| 114 | + include_once SMARTOBJECT_ROOT_PATH.'class/smartobjectcontroller.php'; |
|
| 115 | 115 | $controller = new SmartObjectController($this->handler); |
| 116 | 116 | |
| 117 | 117 | if (!$this->_categoryPath) { |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | exit; |
| 129 | 129 | } |
| 130 | 130 | $parentid = $parentObj->getVar('parentid'); |
| 131 | - $ret = $parentObj->getCategoryPath($withAllLink, $currentCategory) . ' > ' . $ret; |
|
| 131 | + $ret = $parentObj->getCategoryPath($withAllLink, $currentCategory).' > '.$ret; |
|
| 132 | 132 | } |
| 133 | 133 | $this->_categoryPath = $ret; |
| 134 | 134 | } |
@@ -203,7 +203,7 @@ discard block |
||
| 203 | 203 | { |
| 204 | 204 | if (!$this->allCategoriesId) { |
| 205 | 205 | $ret = array(); |
| 206 | - $sql = 'SELECT categoryid, parentid FROM ' . $this->table . ' AS ' . $this->_itemname . ' ORDER BY parentid'; |
|
| 206 | + $sql = 'SELECT categoryid, parentid FROM '.$this->table.' AS '.$this->_itemname.' ORDER BY parentid'; |
|
| 207 | 207 | |
| 208 | 208 | $result = $this->db->query($sql); |
| 209 | 209 | |
@@ -80,9 +80,9 @@ |
||
| 80 | 80 | * @link http://smartfactory.ca The SmartFactory |
| 81 | 81 | * @package SmartObject |
| 82 | 82 | */ |
| 83 | -mt_srand((double)microtime() * 1000000); |
|
| 83 | +mt_srand((double) microtime() * 1000000); |
|
| 84 | 84 | |
| 85 | -include_once XOOPS_ROOT_PATH . '/class/uploader.php'; |
|
| 85 | +include_once XOOPS_ROOT_PATH.'/class/uploader.php'; |
|
| 86 | 86 | |
| 87 | 87 | /** |
| 88 | 88 | * Class SmartUploader |
@@ -12,9 +12,9 @@ discard block |
||
| 12 | 12 | |
| 13 | 13 | // defined('XOOPS_ROOT_PATH') || exit('XOOPS root path not defined'); |
| 14 | 14 | |
| 15 | -include_once XOOPS_ROOT_PATH . '/modules/smartobject/include/common.php'; |
|
| 15 | +include_once XOOPS_ROOT_PATH.'/modules/smartobject/include/common.php'; |
|
| 16 | 16 | |
| 17 | -include_once SMARTOBJECT_ROOT_PATH . 'class/smartobjectcontroller.php'; |
|
| 17 | +include_once SMARTOBJECT_ROOT_PATH.'class/smartobjectcontroller.php'; |
|
| 18 | 18 | |
| 19 | 19 | if (!defined('XOBJ_DTYPE_SIMPLE_ARRAY')) { |
| 20 | 20 | define('XOBJ_DTYPE_SIMPLE_ARRAY', 101); |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | */ |
| 114 | 114 | public function closeSection($section_name) |
| 115 | 115 | { |
| 116 | - $this->initVar('close_section_' . $section_name, XOBJ_DTYPE_FORM_SECTION_CLOSE, '', false, null, '', false, '', '', false, false, true); |
|
| 116 | + $this->initVar('close_section_'.$section_name, XOBJ_DTYPE_FORM_SECTION_CLOSE, '', false, null, '', false, '', '', false, false, true); |
|
| 117 | 117 | } |
| 118 | 118 | |
| 119 | 119 | /** |
@@ -140,13 +140,13 @@ discard block |
||
| 140 | 140 | } |
| 141 | 141 | parent::initVar($key, $data_type, $value, $required, $maxlength, $options); |
| 142 | 142 | if ($this->handler && (!$form_caption || $form_caption === '')) { |
| 143 | - $dyn_form_caption = strtoupper('_CO_' . $this->handler->_moduleName . '_' . $this->handler->_itemname . '_' . $key); |
|
| 143 | + $dyn_form_caption = strtoupper('_CO_'.$this->handler->_moduleName.'_'.$this->handler->_itemname.'_'.$key); |
|
| 144 | 144 | if (defined($dyn_form_caption)) { |
| 145 | 145 | $form_caption = constant($dyn_form_caption); |
| 146 | 146 | } |
| 147 | 147 | } |
| 148 | 148 | if ($this->handler && (!$form_dsc || $form_dsc === '')) { |
| 149 | - $dyn_form_dsc = strtoupper('_CO_' . $this->handler->_moduleName . '_' . $this->handler->_itemname . '_' . $key . '_DSC'); |
|
| 149 | + $dyn_form_dsc = strtoupper('_CO_'.$this->handler->_moduleName.'_'.$this->handler->_itemname.'_'.$key.'_DSC'); |
|
| 150 | 150 | if (defined($dyn_form_dsc)) { |
| 151 | 151 | $form_dsc = constant($dyn_form_dsc); |
| 152 | 152 | } |
@@ -410,7 +410,7 @@ discard block |
||
| 410 | 410 | */ |
| 411 | 411 | public function getForm($form_caption, $form_name, $form_action = false, $submit_button_caption = _CO_SOBJECT_SUBMIT, $cancel_js_action = false, $captcha = false) |
| 412 | 412 | { |
| 413 | - include_once SMARTOBJECT_ROOT_PATH . 'class/form/smartobjectform.php'; |
|
| 413 | + include_once SMARTOBJECT_ROOT_PATH.'class/form/smartobjectform.php'; |
|
| 414 | 414 | $form = new SmartobjectForm($this, $form_name, $form_caption, $form_action, null, $submit_button_caption, $cancel_js_action, $captcha); |
| 415 | 415 | |
| 416 | 416 | return $form; |
@@ -422,7 +422,7 @@ discard block |
||
| 422 | 422 | public function toArray() |
| 423 | 423 | { |
| 424 | 424 | $ret = array(); |
| 425 | - $vars =& $this->getVars(); |
|
| 425 | + $vars = & $this->getVars(); |
|
| 426 | 426 | foreach ($vars as $key => $var) { |
| 427 | 427 | $value = $this->getVar($key); |
| 428 | 428 | $ret[$key] = $value; |
@@ -440,7 +440,7 @@ discard block |
||
| 440 | 440 | } |
| 441 | 441 | |
| 442 | 442 | // Hightlighting searched words |
| 443 | - include_once(SMARTOBJECT_ROOT_PATH . 'class/smarthighlighter.php'); |
|
| 443 | + include_once(SMARTOBJECT_ROOT_PATH.'class/smarthighlighter.php'); |
|
| 444 | 444 | $highlight = smart_getConfig('module_search_highlighter', false, true); |
| 445 | 445 | |
| 446 | 446 | if ($highlight && isset($_GET['keywords'])) { |
@@ -471,7 +471,7 @@ discard block |
||
| 471 | 471 | } |
| 472 | 472 | } else { |
| 473 | 473 | if ($prefix) { |
| 474 | - $err_str = '[' . $prefix . '] ' . $err_str; |
|
| 474 | + $err_str = '['.$prefix.'] '.$err_str; |
|
| 475 | 475 | } |
| 476 | 476 | parent::setErrors($err_str); |
| 477 | 477 | } |
@@ -798,8 +798,8 @@ discard block |
||
| 798 | 798 | $this->setErrors(sprintf(_XOBJ_ERR_REQUIRED, $k)); |
| 799 | 799 | continue 2; |
| 800 | 800 | } |
| 801 | - if (isset($v['maxlength']) && strlen($cleanv) > (int)$v['maxlength']) { |
|
| 802 | - $this->setErrors(sprintf(_XOBJ_ERR_SHORTERTHAN, $k, (int)$v['maxlength'])); |
|
| 801 | + if (isset($v['maxlength']) && strlen($cleanv) > (int) $v['maxlength']) { |
|
| 802 | + $this->setErrors(sprintf(_XOBJ_ERR_SHORTERTHAN, $k, (int) $v['maxlength'])); |
|
| 803 | 803 | continue 2; |
| 804 | 804 | } |
| 805 | 805 | if (!$v['not_gpc']) { |
@@ -828,7 +828,7 @@ discard block |
||
| 828 | 828 | break; |
| 829 | 829 | case XOBJ_DTYPE_INT: |
| 830 | 830 | case XOBJ_DTYPE_TIME_ONLY: |
| 831 | - $cleanv = (int)$cleanv; |
|
| 831 | + $cleanv = (int) $cleanv; |
|
| 832 | 832 | break; |
| 833 | 833 | |
| 834 | 834 | case XOBJ_DTYPE_CURRENCY: |
@@ -858,10 +858,10 @@ discard block |
||
| 858 | 858 | continue 2; |
| 859 | 859 | } |
| 860 | 860 | if ($cleanv !== '' && !preg_match("/^http[s]*:\/\//i", $cleanv)) { |
| 861 | - $cleanv = 'http://' . $cleanv; |
|
| 861 | + $cleanv = 'http://'.$cleanv; |
|
| 862 | 862 | } |
| 863 | 863 | if (!$v['not_gpc']) { |
| 864 | - $cleanv =& $ts->stripSlashesGPC($cleanv); |
|
| 864 | + $cleanv = & $ts->stripSlashesGPC($cleanv); |
|
| 865 | 865 | } |
| 866 | 866 | break; |
| 867 | 867 | case XOBJ_DTYPE_SIMPLE_ARRAY: |
@@ -873,7 +873,7 @@ discard block |
||
| 873 | 873 | case XOBJ_DTYPE_STIME: |
| 874 | 874 | case XOBJ_DTYPE_MTIME: |
| 875 | 875 | case XOBJ_DTYPE_LTIME: |
| 876 | - $cleanv = !is_string($cleanv) ? (int)$cleanv : strtotime($cleanv); |
|
| 876 | + $cleanv = !is_string($cleanv) ? (int) $cleanv : strtotime($cleanv); |
|
| 877 | 877 | if (!($cleanv > 0)) { |
| 878 | 878 | $cleanv = strtotime($cleanv); |
| 879 | 879 | } |
@@ -882,7 +882,7 @@ discard block |
||
| 882 | 882 | break; |
| 883 | 883 | } |
| 884 | 884 | } |
| 885 | - $this->cleanVars[$k] =& $cleanv; |
|
| 885 | + $this->cleanVars[$k] = & $cleanv; |
|
| 886 | 886 | unset($cleanv); |
| 887 | 887 | } |
| 888 | 888 | if (count($this->_errors) > 0) { |
@@ -1100,10 +1100,10 @@ discard block |
||
| 1100 | 1100 | } |
| 1101 | 1101 | break; |
| 1102 | 1102 | case XOBJ_DTYPE_SIMPLE_ARRAY: |
| 1103 | - $ret =& explode('|', $ret); |
|
| 1103 | + $ret = & explode('|', $ret); |
|
| 1104 | 1104 | break; |
| 1105 | 1105 | case XOBJ_DTYPE_ARRAY: |
| 1106 | - $ret =& unserialize($ret); |
|
| 1106 | + $ret = & unserialize($ret); |
|
| 1107 | 1107 | break; |
| 1108 | 1108 | case XOBJ_DTYPE_SOURCE: |
| 1109 | 1109 | switch (strtolower($format)) { |
@@ -1257,7 +1257,7 @@ discard block |
||
| 1257 | 1257 | */ |
| 1258 | 1258 | public function displaySingleObject($fetchOnly = false, $userSide = false, $actions = array(), $headerAsRow = true) |
| 1259 | 1259 | { |
| 1260 | - include_once SMARTOBJECT_ROOT_PATH . 'class/smartobjectsingleview.php'; |
|
| 1260 | + include_once SMARTOBJECT_ROOT_PATH.'class/smartobjectsingleview.php'; |
|
| 1261 | 1261 | $singleview = new SmartObjectSingleView($this, $userSide, $actions, $headerAsRow); |
| 1262 | 1262 | // add all fields mark as displayOnSingleView except the keyid |
| 1263 | 1263 | foreach ($this->vars as $key => $var) { |
@@ -174,7 +174,7 @@ discard block |
||
| 174 | 174 | */ |
| 175 | 175 | public function addActionButton($op, $caption = false, $text = false) |
| 176 | 176 | { |
| 177 | - $action = array( |
|
| 177 | + $action = array( |
|
| 178 | 178 | 'op' => $op, |
| 179 | 179 | 'caption' => $caption, |
| 180 | 180 | 'text' => $text |
@@ -209,7 +209,7 @@ discard block |
||
| 209 | 209 | { |
| 210 | 210 | $current_urls = smart_getCurrentUrls(); |
| 211 | 211 | $current_url = $current_urls['full']; |
| 212 | - $this->_printerFriendlyPage = $current_url . '&print'; |
|
| 212 | + $this->_printerFriendlyPage = $current_url.'&print'; |
|
| 213 | 213 | } |
| 214 | 214 | |
| 215 | 215 | /** |
@@ -242,7 +242,7 @@ discard block |
||
| 242 | 242 | */ |
| 243 | 243 | public function addDefaultIntroButton($caption) |
| 244 | 244 | { |
| 245 | - $this->addIntroButton($this->_objectHandler->_itemname, $this->_objectHandler->_page . '?op=mod', $caption); |
|
| 245 | + $this->addIntroButton($this->_objectHandler->_itemname, $this->_objectHandler->_page.'?op=mod', $caption); |
|
| 246 | 246 | } |
| 247 | 247 | |
| 248 | 248 | /** |
@@ -267,9 +267,9 @@ discard block |
||
| 267 | 267 | public function getDefaultSort() |
| 268 | 268 | { |
| 269 | 269 | if ($this->_sortsel) { |
| 270 | - return smart_getCookieVar($_SERVER['PHP_SELF'] . '_' . $this->_id . '_sortsel', $this->_sortsel); |
|
| 270 | + return smart_getCookieVar($_SERVER['PHP_SELF'].'_'.$this->_id.'_sortsel', $this->_sortsel); |
|
| 271 | 271 | } else { |
| 272 | - return smart_getCookieVar($_SERVER['PHP_SELF'] . '_' . $this->_id . '_sortsel', $this->_objectHandler->identifierName); |
|
| 272 | + return smart_getCookieVar($_SERVER['PHP_SELF'].'_'.$this->_id.'_sortsel', $this->_objectHandler->identifierName); |
|
| 273 | 273 | } |
| 274 | 274 | } |
| 275 | 275 | |
@@ -287,9 +287,9 @@ discard block |
||
| 287 | 287 | public function getDefaultOrder() |
| 288 | 288 | { |
| 289 | 289 | if ($this->_ordersel) { |
| 290 | - return smart_getCookieVar($_SERVER['PHP_SELF'] . '_' . $this->_id . '_ordersel', $this->_ordersel); |
|
| 290 | + return smart_getCookieVar($_SERVER['PHP_SELF'].'_'.$this->_id.'_ordersel', $this->_ordersel); |
|
| 291 | 291 | } else { |
| 292 | - return smart_getCookieVar($_SERVER['PHP_SELF'] . '_' . $this->_id . '_ordersel', 'ASC'); |
|
| 292 | + return smart_getCookieVar($_SERVER['PHP_SELF'].'_'.$this->_id.'_ordersel', 'ASC'); |
|
| 293 | 293 | } |
| 294 | 294 | } |
| 295 | 295 | |
@@ -338,20 +338,20 @@ discard block |
||
| 338 | 338 | |
| 339 | 339 | public function setSortOrder() |
| 340 | 340 | { |
| 341 | - $this->_sortsel = isset($_GET[$this->_objectHandler->_itemname . '_' . 'sortsel']) ? $_GET[$this->_objectHandler->_itemname . '_' . 'sortsel'] : $this->getDefaultSort(); |
|
| 341 | + $this->_sortsel = isset($_GET[$this->_objectHandler->_itemname.'_'.'sortsel']) ? $_GET[$this->_objectHandler->_itemname.'_'.'sortsel'] : $this->getDefaultSort(); |
|
| 342 | 342 | //$this->_sortsel = isset($_POST['sortsel']) ? $_POST['sortsel']: $this->_sortsel; |
| 343 | - smart_setCookieVar($_SERVER['PHP_SELF'] . '_' . $this->_id . '_sortsel', $this->_sortsel); |
|
| 343 | + smart_setCookieVar($_SERVER['PHP_SELF'].'_'.$this->_id.'_sortsel', $this->_sortsel); |
|
| 344 | 344 | $fieldsForSorting = $this->_tempObject->getFieldsForSorting($this->_sortsel); |
| 345 | 345 | |
| 346 | 346 | if (isset($this->_tempObject->vars[$this->_sortsel]['itemName']) && $this->_tempObject->vars[$this->_sortsel]['itemName']) { |
| 347 | - $this->_criteria->setSort($this->_tempObject->vars[$this->_sortsel]['itemName'] . '.' . $this->_sortsel); |
|
| 347 | + $this->_criteria->setSort($this->_tempObject->vars[$this->_sortsel]['itemName'].'.'.$this->_sortsel); |
|
| 348 | 348 | } else { |
| 349 | - $this->_criteria->setSort($this->_objectHandler->_itemname . '.' . $this->_sortsel); |
|
| 349 | + $this->_criteria->setSort($this->_objectHandler->_itemname.'.'.$this->_sortsel); |
|
| 350 | 350 | } |
| 351 | 351 | |
| 352 | - $this->_ordersel = isset($_GET[$this->_objectHandler->_itemname . '_' . 'ordersel']) ? $_GET[$this->_objectHandler->_itemname . '_' . 'ordersel'] : $this->getDefaultOrder(); |
|
| 352 | + $this->_ordersel = isset($_GET[$this->_objectHandler->_itemname.'_'.'ordersel']) ? $_GET[$this->_objectHandler->_itemname.'_'.'ordersel'] : $this->getDefaultOrder(); |
|
| 353 | 353 | //$this->_ordersel = isset($_POST['ordersel']) ? $_POST['ordersel']:$this->_ordersel; |
| 354 | - smart_setCookieVar($_SERVER['PHP_SELF'] . '_' . $this->_id . '_ordersel', $this->_ordersel); |
|
| 354 | + smart_setCookieVar($_SERVER['PHP_SELF'].'_'.$this->_id.'_ordersel', $this->_ordersel); |
|
| 355 | 355 | $ordersArray = $this->getOrdersArray(); |
| 356 | 356 | $this->_criteria->setOrder($this->_ordersel); |
| 357 | 357 | } |
@@ -401,7 +401,7 @@ discard block |
||
| 401 | 401 | //$object->initiateCustomFields(); |
| 402 | 402 | } |
| 403 | 403 | if ($column->_keyname === 'checked') { |
| 404 | - $value = '<input type ="checkbox" name="selected_smartobjects[]" value="' . $object->id() . '" />'; |
|
| 404 | + $value = '<input type ="checkbox" name="selected_smartobjects[]" value="'.$object->id().'" />'; |
|
| 405 | 405 | } elseif ($column->_customMethodForValue && method_exists($object, $column->_customMethodForValue)) { |
| 406 | 406 | $method = $column->_customMethodForValue; |
| 407 | 407 | if ($column->_param) { |
@@ -445,7 +445,7 @@ discard block |
||
| 445 | 445 | } |
| 446 | 446 | } |
| 447 | 447 | |
| 448 | - include_once SMARTOBJECT_ROOT_PATH . 'class/smartobjectcontroller.php'; |
|
| 448 | + include_once SMARTOBJECT_ROOT_PATH.'class/smartobjectcontroller.php'; |
|
| 449 | 449 | $controller = new SmartObjectController($this->_objectHandler); |
| 450 | 450 | |
| 451 | 451 | if ((!is_array($this->_actions)) || in_array('edit', $this->_actions)) { |
@@ -485,9 +485,9 @@ discard block |
||
| 485 | 485 | public function getDefaultFilter() |
| 486 | 486 | { |
| 487 | 487 | if ($this->_filtersel) { |
| 488 | - return smart_getCookieVar($_SERVER['PHP_SELF'] . '_' . $this->_id . '_filtersel', $this->_filtersel); |
|
| 488 | + return smart_getCookieVar($_SERVER['PHP_SELF'].'_'.$this->_id.'_filtersel', $this->_filtersel); |
|
| 489 | 489 | } else { |
| 490 | - return smart_getCookieVar($_SERVER['PHP_SELF'] . '_' . $this->_id . '_filtersel', 'default'); |
|
| 490 | + return smart_getCookieVar($_SERVER['PHP_SELF'].'_'.$this->_id.'_filtersel', 'default'); |
|
| 491 | 491 | } |
| 492 | 492 | } |
| 493 | 493 | |
@@ -537,9 +537,9 @@ discard block |
||
| 537 | 537 | public function getDefaultFilter2() |
| 538 | 538 | { |
| 539 | 539 | if ($this->_filtersel2) { |
| 540 | - return smart_getCookieVar($_SERVER['PHP_SELF'] . '_filtersel2', $this->_filtersel2); |
|
| 540 | + return smart_getCookieVar($_SERVER['PHP_SELF'].'_filtersel2', $this->_filtersel2); |
|
| 541 | 541 | } else { |
| 542 | - return smart_getCookieVar($_SERVER['PHP_SELF'] . '_filtersel2', 'default'); |
|
| 542 | + return smart_getCookieVar($_SERVER['PHP_SELF'].'_filtersel2', 'default'); |
|
| 543 | 543 | } |
| 544 | 544 | } |
| 545 | 545 | |
@@ -667,7 +667,7 @@ discard block |
||
| 667 | 667 | */ |
| 668 | 668 | public function render($fetchOnly = false, $debug = false) |
| 669 | 669 | { |
| 670 | - include_once XOOPS_ROOT_PATH . '/class/template.php'; |
|
| 670 | + include_once XOOPS_ROOT_PATH.'/class/template.php'; |
|
| 671 | 671 | |
| 672 | 672 | $this->_tpl = new XoopsTpl(); |
| 673 | 673 | |
@@ -678,24 +678,24 @@ discard block |
||
| 678 | 678 | */ |
| 679 | 679 | $this->_tempObject = $this->_objectHandler->create(); |
| 680 | 680 | |
| 681 | - $this->_criteria->setStart(isset($_GET['start' . $this->_objectHandler->keyName]) ? (int)$_GET['start' . $this->_objectHandler->keyName] : 0); |
|
| 681 | + $this->_criteria->setStart(isset($_GET['start'.$this->_objectHandler->keyName]) ? (int) $_GET['start'.$this->_objectHandler->keyName] : 0); |
|
| 682 | 682 | |
| 683 | 683 | $this->setSortOrder(); |
| 684 | 684 | |
| 685 | 685 | if (!$this->_isTree) { |
| 686 | - $this->_limitsel = isset($_GET['limitsel']) ? $_GET['limitsel'] : smart_getCookieVar($_SERVER['PHP_SELF'] . '_limitsel', '15'); |
|
| 686 | + $this->_limitsel = isset($_GET['limitsel']) ? $_GET['limitsel'] : smart_getCookieVar($_SERVER['PHP_SELF'].'_limitsel', '15'); |
|
| 687 | 687 | } else { |
| 688 | 688 | $this->_limitsel = 'all'; |
| 689 | 689 | } |
| 690 | 690 | |
| 691 | 691 | $this->_limitsel = isset($_POST['limitsel']) ? $_POST['limitsel'] : $this->_limitsel; |
| 692 | - smart_setCookieVar($_SERVER['PHP_SELF'] . '_limitsel', $this->_limitsel); |
|
| 692 | + smart_setCookieVar($_SERVER['PHP_SELF'].'_limitsel', $this->_limitsel); |
|
| 693 | 693 | $limitsArray = $this->getLimitsArray(); |
| 694 | 694 | $this->_criteria->setLimit($this->_limitsel); |
| 695 | 695 | |
| 696 | 696 | $this->_filtersel = isset($_GET['filtersel']) ? $_GET['filtersel'] : $this->getDefaultFilter(); |
| 697 | 697 | $this->_filtersel = isset($_POST['filtersel']) ? $_POST['filtersel'] : $this->_filtersel; |
| 698 | - smart_setCookieVar($_SERVER['PHP_SELF'] . '_' . $this->_id . '_filtersel', $this->_filtersel); |
|
| 698 | + smart_setCookieVar($_SERVER['PHP_SELF'].'_'.$this->_id.'_filtersel', $this->_filtersel); |
|
| 699 | 699 | $filtersArray = $this->getFiltersArray(); |
| 700 | 700 | |
| 701 | 701 | if ($filtersArray) { |
@@ -721,7 +721,7 @@ discard block |
||
| 721 | 721 | $filters2Array = $this->getFilters2Array(); |
| 722 | 722 | $this->_tpl->assign('smartobject_optionssel_filters2Array', $filters2Array); |
| 723 | 723 | |
| 724 | - smart_setCookieVar($_SERVER['PHP_SELF'] . '_filtersel2', $this->_filtersel2); |
|
| 724 | + smart_setCookieVar($_SERVER['PHP_SELF'].'_filtersel2', $this->_filtersel2); |
|
| 725 | 725 | if ($this->_filtersel2 !== 'default') { |
| 726 | 726 | $this->_criteria->add(new Criteria($this->_filtersel, $this->_filtersel2)); |
| 727 | 727 | } |
@@ -730,21 +730,21 @@ discard block |
||
| 730 | 730 | } |
| 731 | 731 | // Check if we have a quicksearch |
| 732 | 732 | |
| 733 | - if (isset($_POST['quicksearch_' . $this->_id]) && $_POST['quicksearch_' . $this->_id] != '') { |
|
| 733 | + if (isset($_POST['quicksearch_'.$this->_id]) && $_POST['quicksearch_'.$this->_id] != '') { |
|
| 734 | 734 | $quicksearch_criteria = new CriteriaCompo(); |
| 735 | 735 | if (is_array($this->_quickSearch['fields'])) { |
| 736 | 736 | foreach ($this->_quickSearch['fields'] as $v) { |
| 737 | - $quicksearch_criteria->add(new Criteria($v, '%' . $_POST['quicksearch_' . $this->_id] . '%', 'LIKE'), 'OR'); |
|
| 737 | + $quicksearch_criteria->add(new Criteria($v, '%'.$_POST['quicksearch_'.$this->_id].'%', 'LIKE'), 'OR'); |
|
| 738 | 738 | } |
| 739 | 739 | } else { |
| 740 | - $quicksearch_criteria->add(new Criteria($this->_quickSearch['fields'], '%' . $_POST['quicksearch_' . $this->_id] . '%', 'LIKE')); |
|
| 740 | + $quicksearch_criteria->add(new Criteria($this->_quickSearch['fields'], '%'.$_POST['quicksearch_'.$this->_id].'%', 'LIKE')); |
|
| 741 | 741 | } |
| 742 | 742 | $this->_criteria->add($quicksearch_criteria); |
| 743 | 743 | } |
| 744 | 744 | |
| 745 | 745 | $this->_objects = $this->fetchObjects($debug); |
| 746 | 746 | |
| 747 | - include_once XOOPS_ROOT_PATH . '/class/pagenav.php'; |
|
| 747 | + include_once XOOPS_ROOT_PATH.'/class/pagenav.php'; |
|
| 748 | 748 | if ($this->_criteria->getLimit() > 0) { |
| 749 | 749 | |
| 750 | 750 | /** |
@@ -760,7 +760,7 @@ discard block |
||
| 760 | 760 | */ |
| 761 | 761 | $params_of_the_options_sel = array(); |
| 762 | 762 | |
| 763 | - $not_needed_params = array('sortsel', 'limitsel', 'ordersel', 'start' . $this->_objectHandler->keyName); |
|
| 763 | + $not_needed_params = array('sortsel', 'limitsel', 'ordersel', 'start'.$this->_objectHandler->keyName); |
|
| 764 | 764 | foreach ($_GET as $k => $v) { |
| 765 | 765 | if (!in_array($k, $not_needed_params)) { |
| 766 | 766 | $new_get_array[] = "$k=$v"; |
@@ -771,13 +771,13 @@ discard block |
||
| 771 | 771 | /** |
| 772 | 772 | * Adding the new params of the pagenav |
| 773 | 773 | */ |
| 774 | - $new_get_array[] = 'sortsel=' . $this->_sortsel; |
|
| 775 | - $new_get_array[] = 'ordersel=' . $this->_ordersel; |
|
| 776 | - $new_get_array[] = 'limitsel=' . $this->_limitsel; |
|
| 774 | + $new_get_array[] = 'sortsel='.$this->_sortsel; |
|
| 775 | + $new_get_array[] = 'ordersel='.$this->_ordersel; |
|
| 776 | + $new_get_array[] = 'limitsel='.$this->_limitsel; |
|
| 777 | 777 | $otherParams = implode('&', $new_get_array); |
| 778 | 778 | |
| 779 | 779 | $pagenav = |
| 780 | - new XoopsPageNav($this->_objectHandler->getCount($this->_criteria), $this->_criteria->getLimit(), $this->_criteria->getStart(), 'start' . $this->_objectHandler->keyName, $otherParams); |
|
| 780 | + new XoopsPageNav($this->_objectHandler->getCount($this->_criteria), $this->_criteria->getLimit(), $this->_criteria->getStart(), 'start'.$this->_objectHandler->keyName, $otherParams); |
|
| 781 | 781 | $this->_tpl->assign('smartobject_pagenav', $pagenav->renderNav()); |
| 782 | 782 | } |
| 783 | 783 | $this->renderOptionSelection($limitsArray, $params_of_the_options_sel); |
@@ -823,12 +823,12 @@ discard block |
||
| 823 | 823 | $aColumn['caption'] = isset($this->_tempObject->vars[$column->getKeyName()]['form_caption']) ? $this->_tempObject->vars[$column->getKeyName()]['form_caption'] : $column->getKeyName(); |
| 824 | 824 | } |
| 825 | 825 | // Are we doing a GET sort on this column ? |
| 826 | - $getSort = (isset($_GET[$this->_objectHandler->_itemname . '_' . 'sortsel']) && $_GET[$this->_objectHandler->_itemname . '_' . 'sortsel'] == $column->getKeyName()) |
|
| 826 | + $getSort = (isset($_GET[$this->_objectHandler->_itemname.'_'.'sortsel']) && $_GET[$this->_objectHandler->_itemname.'_'.'sortsel'] == $column->getKeyName()) |
|
| 827 | 827 | || ($this->_sortsel == $column->getKeyName()); |
| 828 | - $order = isset($_GET[$this->_objectHandler->_itemname . '_' . 'ordersel']) ? $_GET[$this->_objectHandler->_itemname . '_' . 'ordersel'] : 'DESC'; |
|
| 828 | + $order = isset($_GET[$this->_objectHandler->_itemname.'_'.'ordersel']) ? $_GET[$this->_objectHandler->_itemname.'_'.'ordersel'] : 'DESC'; |
|
| 829 | 829 | |
| 830 | - if (isset($_REQUEST['quicksearch_' . $this->_id]) && $_REQUEST['quicksearch_' . $this->_id] != '') { |
|
| 831 | - $qs_param = '&quicksearch_' . $this->_id . '=' . $_REQUEST['quicksearch_' . $this->_id]; |
|
| 830 | + if (isset($_REQUEST['quicksearch_'.$this->_id]) && $_REQUEST['quicksearch_'.$this->_id] != '') { |
|
| 831 | + $qs_param = '&quicksearch_'.$this->_id.'='.$_REQUEST['quicksearch_'.$this->_id]; |
|
| 832 | 832 | } |
| 833 | 833 | if (!$this->_enableColumnsSorting || $column->_keyname === 'checked' || !$column->isSortable()) { |
| 834 | 834 | $aColumn['caption'] = $aColumn['caption']; |
@@ -901,9 +901,9 @@ discard block |
||
| 901 | 901 | |
| 902 | 902 | $smartobjectTable_template = $this->_customTemplate ?: 'smartobject_smarttable_display.tpl'; |
| 903 | 903 | if ($fetchOnly) { |
| 904 | - return $this->_tpl->fetch('db:' . $smartobjectTable_template); |
|
| 904 | + return $this->_tpl->fetch('db:'.$smartobjectTable_template); |
|
| 905 | 905 | } else { |
| 906 | - $this->_tpl->display('db:' . $smartobjectTable_template); |
|
| 906 | + $this->_tpl->display('db:'.$smartobjectTable_template); |
|
| 907 | 907 | } |
| 908 | 908 | } |
| 909 | 909 | |
@@ -37,10 +37,10 @@ |
||
| 37 | 37 | public function executeHook($hook_name) |
| 38 | 38 | { |
| 39 | 39 | $lower_hook_name = strtolower($hook_name); |
| 40 | - $filename = SMARTOBJECT_ROOT_PATH . 'include/custom_code/' . $lower_hook_name . '.php'; |
|
| 40 | + $filename = SMARTOBJECT_ROOT_PATH.'include/custom_code/'.$lower_hook_name.'.php'; |
|
| 41 | 41 | if (file_exists($filename)) { |
| 42 | 42 | include_once($filename); |
| 43 | - $function = 'smarthook_' . $lower_hook_name; |
|
| 43 | + $function = 'smarthook_'.$lower_hook_name; |
|
| 44 | 44 | if (function_exists($function)) { |
| 45 | 45 | $function(); |
| 46 | 46 | } |