These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | /* |
||
3 | You may not change or alter any portion of this comment or credits |
||
4 | of supporting developers from this source code or any supporting source code |
||
5 | which is considered copyrighted (c) material of the original comment or credit authors. |
||
6 | |||
7 | This program is distributed in the hope that it will be useful, |
||
8 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
9 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
||
10 | */ |
||
11 | |||
12 | /** |
||
13 | * oledrion |
||
14 | * |
||
15 | * @copyright {@link https://xoops.org/ XOOPS Project} |
||
16 | * @license {@link http://www.fsf.org/copyleft/gpl.html GNU public license} |
||
17 | * @author Hervé Thouzard (http://www.herve-thouzard.com/) |
||
18 | */ |
||
19 | |||
20 | /** |
||
21 | * Affiche la liste des produits recommandés |
||
22 | */ |
||
23 | require_once __DIR__ . '/header.php'; |
||
24 | $GLOBALS['current_category'] = -1; |
||
25 | $GLOBALS['xoopsOption']['template_main'] = 'oledrion_recommended.tpl'; |
||
26 | require_once XOOPS_ROOT_PATH . '/header.php'; |
||
27 | require_once OLEDRION_PATH . 'class/registryfile.php'; |
||
28 | require_once XOOPS_ROOT_PATH . '/class/pagenav.php'; |
||
29 | |||
30 | // Initialisations |
||
31 | $tbl_products = $tbl_categories = $tbl_vendors = $tbl_users = $tbl_tmp_user = $tbl_tmp_categ = $tbl_tmp_lang = $tbl_tmp_vat = $tbl_vat = array(); |
||
32 | $tbl_products_id = $tbl_auteurs = $tbl_infos_auteurs = $tbl_tmp_auteurs = array(); |
||
33 | $tbl_tmp_related = $tbl_related = $tbl_info_related_products = array(); |
||
34 | $tbl_related_products = array(); |
||
35 | $start = isset($_GET['start']) ? (int)$_GET['start'] : 0; |
||
36 | $limit = OledrionUtility::getModuleOption('perpage'); |
||
37 | $baseurl = OLEDRION_URL . basename(__FILE__); // URL de ce script (sans son nom) |
||
38 | $oledrion_Currency = Oledrion_Currency::getInstance(); |
||
39 | |||
40 | $registry = new oledrion_registryfile(); |
||
41 | |||
42 | // Lecture des TVA ******************************************************************************** |
||
43 | $vatArray = array(); |
||
44 | $vatArray = $h_oledrion_vat->getAllVats(new Oledrion_parameters()); |
||
45 | |||
46 | // Quelques options pour le template |
||
47 | $xoopsTpl->assign('nostock_msg', OledrionUtility::getModuleOption('nostock_msg')); |
||
48 | $xoopsTpl->assign('mod_pref', $mod_pref); // Préférences du module |
||
49 | $xoopsTpl->assign('columnsCount', OledrionUtility::getModuleOption('catagory_colums')); |
||
50 | $xoopsTpl->assign('welcome_msg', nl2br($registry->getfile(OLEDRION_TEXTFILE3))); |
||
51 | |||
52 | // Récupération du nombre total de produits publiés dans la base |
||
53 | $itemsCount = $h_oledrion_products->getRecommendedCount(); |
||
54 | if ($itemsCount > $limit) { |
||
55 | $pagenav = new XoopsPageNav($itemsCount, $limit, $start); |
||
56 | $xoopsTpl->assign('pagenav', $pagenav->renderNav()); |
||
57 | } |
||
58 | |||
59 | if ($limit > 0) { |
||
60 | // Récupération de la liste des produits récents |
||
61 | $oledrion_shelf_parameters->resetDefaultValues()->setProductsType('recommended')->setStart($start)->setLimit($limit)->setSort('product_recommended')->setOrder('DESC')->setCategory(0)->setWithXoopsUser(true)->setWithRelatedProducts(true); |
||
62 | $products = $oledrion_shelf->getProducts($oledrion_shelf_parameters); |
||
63 | View Code Duplication | if (isset($products['lastTitle'])) { |
|
0 ignored issues
–
show
|
|||
64 | $lastTitle = strip_tags($products['lastTitle']); |
||
65 | unset($products['lastTitle']); |
||
66 | } |
||
67 | $xoopsTpl->assign('products', $products); |
||
68 | } |
||
69 | $xoopsTpl->assign('global_advert', OledrionUtility::getModuleOption('advertisement')); |
||
70 | $xoopsTpl->assign('breadcrumb', OledrionUtility::breadcrumb(array(OLEDRION_URL . basename(__FILE__) => _OLEDRION_RECOMMENDED))); |
||
71 | |||
72 | OledrionUtility::setCSS(); |
||
73 | OledrionUtility::setLocalCSS($xoopsConfig['language']); |
||
74 | OledrionUtility::setMetas(_OLEDRION_RECOMMENDED . ' - ' . OledrionUtility::getModuleName(), OledrionUtility::getModuleName()); |
||
75 | require_once XOOPS_ROOT_PATH . '/footer.php'; |
||
76 |
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.