Completed
Push — master ( 00e474...9d3fbd )
by Michael
04:26
created

include/common.php (27 issues)

Upgrade to new PHP Analysis Engine

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 http://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
// defined('XOOPS_ROOT_PATH') || exit('XOOPS root path not defined');
0 ignored issues
show
Unused Code Comprehensibility introduced by
70% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
21
22
// Load config file
23
require XOOPS_ROOT_PATH . '/modules/oledrion/config.php';
24
25
// Les classes pour les plugins
26
require_once OLEDRION_CLASS_PATH . 'oledrion_plugins.php'; // Classe principale
27
require_once OLEDRION_PLUGINS_PATH . 'models/oledrion_action.php'; // modèle
28
require_once OLEDRION_PLUGINS_PATH . 'models/oledrion_filter.php'; // modèle
29
30
// Les classes métier ou utilitaires (non ORM)
31
require_once OLEDRION_CLASS_PATH . 'oledrion_utils.php';
32
require_once OLEDRION_CLASS_PATH . 'oledrion_handlers.php';
33
require_once OLEDRION_CLASS_PATH . 'oledrion_parameters.php';
34
require_once OLEDRION_CLASS_PATH . 'oledrion_currency.php';
35
require_once OLEDRION_CLASS_PATH . 'oledrion_shelf.php';
36
require_once OLEDRION_CLASS_PATH . 'oledrion_shelf_parameters.php';
37
require_once OLEDRION_CLASS_PATH . 'oledrion_reductions.php';
38
require_once OLEDRION_CLASS_PATH . 'oledrion_gateways.php';
39
require_once OLEDRION_ADMIN_PATH . 'gateways/gateway.php'; // La classe abstraite
40
require_once OLEDRION_CLASS_PATH . 'oledrion_lists.php';
41
require_once OLEDRION_CLASS_PATH . 'oledrion_sms.php';
42
43
$oledrionHandlers = OledrionHandler::getInstance();
44
45
$myts = MyTextSanitizer::getInstance();
46
47
// Chargement des handlers
48
$h_oledrion_manufacturer     = $oledrionHandlers->h_oledrion_manufacturer;
0 ignored issues
show
The property h_oledrion_manufacturer does not seem to exist in OledrionHandler.

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
49
$h_oledrion_products         = $oledrionHandlers->h_oledrion_products;
0 ignored issues
show
The property h_oledrion_products does not seem to exist in OledrionHandler.

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
50
$h_oledrion_productsmanu     = $oledrionHandlers->h_oledrion_productsmanu;
0 ignored issues
show
The property h_oledrion_productsmanu does not seem to exist in OledrionHandler.

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
51
$h_oledrion_caddy            = $oledrionHandlers->h_oledrion_caddy;
0 ignored issues
show
The property h_oledrion_caddy does not seem to exist in OledrionHandler.

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
52
$h_oledrion_cat              = $oledrionHandlers->h_oledrion_cat;
0 ignored issues
show
The property h_oledrion_cat does not seem to exist in OledrionHandler.

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
53
$h_oledrion_commands         = $oledrionHandlers->h_oledrion_commands;
0 ignored issues
show
The property h_oledrion_commands does not seem to exist in OledrionHandler.

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
54
$h_oledrion_related          = $oledrionHandlers->h_oledrion_related;
0 ignored issues
show
The property h_oledrion_related does not seem to exist in OledrionHandler.

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
55
$h_oledrion_vat              = $oledrionHandlers->h_oledrion_vat;
0 ignored issues
show
The property h_oledrion_vat does not seem to exist in OledrionHandler.

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
56
$h_oledrion_votedata         = $oledrionHandlers->h_oledrion_votedata;
0 ignored issues
show
The property h_oledrion_votedata does not seem to exist in OledrionHandler.

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
57
$h_oledrion_discounts        = $oledrionHandlers->h_oledrion_discounts;
0 ignored issues
show
The property h_oledrion_discounts does not seem to exist in OledrionHandler.

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
58
$h_oledrion_vendors          = $oledrionHandlers->h_oledrion_vendors;
0 ignored issues
show
The property h_oledrion_vendors does not seem to exist in OledrionHandler.

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
59
$h_oledrion_files            = $oledrionHandlers->h_oledrion_files;
0 ignored issues
show
The property h_oledrion_files does not seem to exist in OledrionHandler.

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
60
$h_oledrion_persistent_cart  = $oledrionHandlers->h_oledrion_persistent_cart;
0 ignored issues
show
The property h_oledrion_persistent_cart does not seem to exist in OledrionHandler.

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
61
$h_oledrion_gateways_options = $oledrionHandlers->h_oledrion_gateways_options;
0 ignored issues
show
The property h_oledrion_gateways_options does not seem to exist in OledrionHandler.

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
62
// Add by voltan
63
$h_oledrion_attributes        = $oledrionHandlers->h_oledrion_attributes;
0 ignored issues
show
The property h_oledrion_attributes does not seem to exist in OledrionHandler.

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
64
$h_oledrion_caddy_attributes  = $oledrionHandlers->h_oledrion_caddy_attributes;
0 ignored issues
show
The property h_oledrion_caddy_attributes does not seem to exist in OledrionHandler.

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
65
$h_oledrion_products_list     = $oledrionHandlers->h_oledrion_products_list;
0 ignored issues
show
The property h_oledrion_products_list does not seem to exist in OledrionHandler.

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
66
$h_oledrion_lists             = $oledrionHandlers->h_oledrion_lists;
0 ignored issues
show
The property h_oledrion_lists does not seem to exist in OledrionHandler.

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
67
$h_oledrion_delivery          = $oledrionHandlers->h_oledrion_delivery;
0 ignored issues
show
The property h_oledrion_delivery does not seem to exist in OledrionHandler.

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
68
$h_oledrion_location          = $oledrionHandlers->h_oledrion_location;
0 ignored issues
show
The property h_oledrion_location does not seem to exist in OledrionHandler.

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
69
$h_oledrion_packing           = $oledrionHandlers->h_oledrion_packing;
0 ignored issues
show
The property h_oledrion_packing does not seem to exist in OledrionHandler.

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
70
$h_oledrion_payment           = $oledrionHandlers->h_oledrion_payment;
0 ignored issues
show
The property h_oledrion_payment does not seem to exist in OledrionHandler.

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
71
$h_oledrion_location_delivery = $oledrionHandlers->h_oledrion_location_delivery;
0 ignored issues
show
The property h_oledrion_location_delivery does not seem to exist in OledrionHandler.

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
72
$h_oledrion_delivery_payment  = $oledrionHandlers->h_oledrion_delivery_payment;
0 ignored issues
show
The property h_oledrion_delivery_payment does not seem to exist in OledrionHandler.

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
73
$h_oledrion_payment_log       = $oledrionHandlers->h_oledrion_payment_log;
0 ignored issues
show
The property h_oledrion_payment_log does not seem to exist in OledrionHandler.

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
74
75
$oledrion_shelf            = new oledrion_shelf(); // Façade
76
$oledrion_shelf_parameters = new oledrion_shelf_parameters(); // Les paramètres de la façade
77
78
// Définition des images
79
if (!defined('_OLEDRION_EDIT')) {
80
    global $xoopsConfig;
81 View Code Duplication
    if (file_exists(OLEDRION_PATH . 'language/' . $xoopsConfig['language'] . '/main.php')) {
0 ignored issues
show
This code seems to be duplicated across your project.

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.

Loading history...
82
        include OLEDRION_PATH . 'language/' . $xoopsConfig['language'] . '/main.php';
83
    } else {
84
        include OLEDRION_PATH . 'language/english/main.php';
85
    }
86
}
87
88
global $xoopsModule;
89
$dirname       = basename(dirname(__DIR__));
90
/** @var XoopsModuleHandler $moduleHandler */
91
$moduleHandler = xoops_getHandler('module');
92
$module        = $moduleHandler->getByDirname($dirname);
93
$pathIcon16    = '../' . $module->getInfo('icons16');
94
95
$icones = array(
96
    'edit'     => "<img src='" . $pathIcon16 . "/edit.png'  alt=" . _OLEDRION_EDIT . "' align='middle' />",
97
    'delete'   => "<img src='" . $pathIcon16 . "/delete.png' alt='" . _OLEDRION_DELETE . "' align='middle' />",
98
    'online'   => "<img src='" . OLEDRION_IMAGES_URL . "online.gif' alt='" . _OLEDRION_ONLINE . "' align='middle' />",
99
    'offline'  => "<img src='" . OLEDRION_IMAGES_URL . "offline.gif' alt='" . _OLEDRION_OFFLINE . "' align='middle' />",
100
    'ok'       => "<img src='" . OLEDRION_IMAGES_URL . "ok.png' alt='" . _OLEDRION_VALIDATE_COMMAND . "' align='middle' />",
101
    'copy'     => "<img src='" . $pathIcon16 . "/editcopy.png' alt='" . _OLEDRION_DUPLICATE_PRODUCT . "' align='middle' />",
102
    'details'  => "<img src='" . OLEDRION_IMAGES_URL . "details.png' alt='" . _OLEDRION_DETAILS . "' align='middle' />",
103
    'print'    => "<img src='" . OLEDRION_IMAGES_URL . "print.png' alt='" . _OLEDRION_PRINT_VERSION . "' align='middle' />",
104
    'delivery' => "<img src='" . OLEDRION_IMAGES_URL . "delivery.png' alt='" . _OLEDRION_DELIVERY . "' align='middle' />",
105
    'package'  => "<img src='" . OLEDRION_IMAGES_URL . "package.png' alt='" . _OLEDRION_PACK . "' align='middle' />",
106
    'submit'   => "<img src='" . OLEDRION_IMAGES_URL . "submit.png' alt='" . _OLEDRION_SUBMIT . "' align='middle' />",
107
    'track'    => "<img src='" . OLEDRION_IMAGES_URL . "track.png' alt='" . _OLEDRION_TRACK . "' align='middle' />"
108
);
109
110
// Chargement de quelques préférences
111
$mod_pref = array(
112
    'money_short'     => Oledrion_utils::getModuleOption('money_short'),
113
    'money_full'      => Oledrion_utils::getModuleOption('money_full'),
114
    'url_rewriting'   => Oledrion_utils::getModuleOption('urlrewriting'),
115
    'tooltip'         => Oledrion_utils::getModuleOption('infotips'),
116
    'advertisement'   => Oledrion_utils::getModuleOption('advertisement'),
117
    'rss'             => Oledrion_utils::getModuleOption('use_rss'),
118
    'nostock_msg'     => Oledrion_utils::getModuleOption('nostock_msg'),
119
    'use_price'       => Oledrion_utils::getModuleOption('use_price'),
120
    'restrict_orders' => Oledrion_utils::getModuleOption('restrict_orders'),
121
    'isAdmin'         => Oledrion_utils::isAdmin()
122
);
123