XoopsModules25x /
oledrion
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 Hossein Azizabadi ([email protected]) |
||
| 18 | */ |
||
| 19 | |||
| 20 | require __DIR__ . '/classheader.php'; |
||
| 21 | |||
| 22 | /** |
||
| 23 | * Class Oledrion_payment |
||
| 24 | */ |
||
| 25 | class Oledrion_payment extends Oledrion_Object |
||
| 26 | { |
||
| 27 | /** |
||
| 28 | * constructor |
||
| 29 | * |
||
| 30 | * normally, this is called from child classes only |
||
| 31 | * |
||
| 32 | * @access public |
||
| 33 | */ |
||
| 34 | public function __construct() |
||
| 35 | { |
||
| 36 | $this->initVar('payment_id', XOBJ_DTYPE_INT, null, false); |
||
| 37 | $this->initVar('payment_title', XOBJ_DTYPE_TXTBOX, null, false); |
||
| 38 | $this->initVar('payment_description', XOBJ_DTYPE_TXTAREA, null, false); |
||
| 39 | $this->initVar('payment_online', XOBJ_DTYPE_INT, null, false); |
||
| 40 | $this->initVar('payment_type', XOBJ_DTYPE_TXTBOX, null, false); |
||
| 41 | $this->initVar('payment_gateway', XOBJ_DTYPE_TXTBOX, null, false); |
||
| 42 | $this->initVar('payment_image', XOBJ_DTYPE_TXTBOX, null, false); |
||
| 43 | } |
||
| 44 | |||
| 45 | /** |
||
| 46 | * Retourne l'URL de l'image de la catégorie courante |
||
| 47 | * @return string L'URL |
||
| 48 | */ |
||
| 49 | View Code Duplication | public function getPictureUrl() |
|
| 50 | { |
||
| 51 | if (xoops_trim($this->getVar('product_image_url')) != '') { |
||
| 52 | return OLEDRION_PICTURES_URL . '/' . $this->getVar('payment_image'); |
||
| 53 | } else { |
||
| 54 | return ''; |
||
| 55 | } |
||
| 56 | } |
||
| 57 | |||
| 58 | /** |
||
| 59 | * Indique si l'image de la catégorie existe |
||
| 60 | * |
||
| 61 | * @return boolean Vrai si l'image existe sinon faux |
||
| 62 | */ |
||
| 63 | View Code Duplication | public function pictureExists() |
|
| 64 | { |
||
| 65 | $return = false; |
||
| 66 | if (xoops_trim($this->getVar('payment_image')) != '' |
||
| 67 | && file_exists(OLEDRION_PICTURES_PATH . '/' . $this->getVar('payment_image')) |
||
| 68 | ) { |
||
| 69 | $return = true; |
||
| 70 | } |
||
| 71 | |||
| 72 | return $return; |
||
| 73 | } |
||
| 74 | |||
| 75 | /** |
||
| 76 | * Supprime l'image associée à une catégorie |
||
| 77 | * @return void |
||
| 78 | */ |
||
| 79 | View Code Duplication | public function deletePicture() |
|
| 80 | { |
||
| 81 | if ($this->pictureExists()) { |
||
| 82 | @unlink(OLEDRION_PICTURES_PATH . '/' . $this->getVar('payment_image')); |
||
|
0 ignored issues
–
show
|
|||
| 83 | } |
||
| 84 | $this->setVar('payment_image', ''); |
||
| 85 | } |
||
| 86 | |||
| 87 | /** |
||
| 88 | * Retourne les éléments du produits formatés pour affichage |
||
| 89 | * |
||
| 90 | * @param string $format |
||
| 91 | * @return array |
||
| 92 | */ |
||
| 93 | View Code Duplication | public function toArray($format = 's') |
|
| 94 | { |
||
| 95 | $ret = array(); |
||
| 96 | $ret = parent::toArray($format); |
||
| 97 | $ret['payment_image_url'] = $this->getPictureUrl(); |
||
| 98 | |||
| 99 | return $ret; |
||
| 100 | } |
||
| 101 | } |
||
| 102 | |||
| 103 | /** |
||
| 104 | * Class OledrionOledrion_paymentHandler |
||
| 105 | */ |
||
| 106 | class OledrionOledrion_paymentHandler extends Oledrion_XoopsPersistableObjectHandler |
||
| 107 | { |
||
| 108 | /** |
||
| 109 | * OledrionOledrion_paymentHandler constructor. |
||
| 110 | * @param XoopsDatabase|null $db |
||
| 111 | */ |
||
| 112 | public function __construct(XoopsDatabase $db) |
||
| 113 | { // Table Classe Id |
||
| 114 | parent::__construct($db, 'oledrion_payment', 'oledrion_payment', 'payment_id'); |
||
| 115 | } |
||
| 116 | |||
| 117 | /** |
||
| 118 | * @param Oledrion_parameters $parameters |
||
| 119 | * @return array |
||
| 120 | */ |
||
| 121 | View Code Duplication | public function getAllPayment(Oledrion_parameters $parameters) |
|
| 122 | { |
||
| 123 | $parameters = $parameters->extend(new Oledrion_parameters(array( |
||
|
0 ignored issues
–
show
new \Oledrion_parameters...id', 'order' => 'ASC')) is of type object<Oledrion_parameters>, but the function expects a object<self>.
It seems like the type of the argument is not accepted by the function/method which you are calling. In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug. We suggest to add an explicit type cast like in the following example: function acceptsInteger($int) { }
$x = '123'; // string "123"
// Instead of
acceptsInteger($x);
// we recommend to use
acceptsInteger((integer) $x);
Loading history...
|
|||
| 124 | 'start' => 0, |
||
| 125 | 'limit' => 0, |
||
| 126 | 'sort' => 'payment_id', |
||
| 127 | 'order' => 'ASC' |
||
| 128 | ))); |
||
| 129 | $critere = new Criteria('payment_id', 0, '<>'); |
||
| 130 | $critere->setLimit($parameters['limit']); |
||
| 131 | $critere->setStart($parameters['start']); |
||
| 132 | $critere->setSort($parameters['sort']); |
||
| 133 | $critere->setOrder($parameters['order']); |
||
| 134 | $categories = array(); |
||
|
0 ignored issues
–
show
$categories is not used, you could remove the assignment.
This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently. $myVar = 'Value';
$higher = false;
if (rand(1, 6) > 3) {
$higher = true;
} else {
$higher = false;
}
Both the Loading history...
|
|||
| 135 | $categories = $this->getObjects($critere); |
||
| 136 | |||
| 137 | return $categories; |
||
| 138 | } |
||
| 139 | |||
| 140 | /** |
||
| 141 | * @param $delivery_id |
||
| 142 | * @return array |
||
| 143 | */ |
||
| 144 | public function getThisDeliveryPayment($delivery_id) |
||
| 145 | { |
||
| 146 | global $h_oledrion_delivery_payment; |
||
| 147 | $ret = array(); |
||
| 148 | $parameters = array('delivery' => $delivery_id); |
||
| 149 | $delivery_payment = $h_oledrion_delivery_payment->getDeliveryPaymantId($parameters); |
||
| 150 | foreach ($delivery_payment as $payment) { |
||
| 151 | $id[] = $payment['dp_payment']; |
||
| 152 | } |
||
| 153 | |||
| 154 | $critere = new CriteriaCompo(); |
||
| 155 | $critere->add(new Criteria('payment_id', '(' . implode(',', $id) . ')', 'IN')); |
||
| 156 | $critere->add(new Criteria('payment_online', 1)); |
||
| 157 | $obj = $this->getObjects($critere); |
||
| 158 | if ($obj) { |
||
| 159 | foreach ($obj as $root) { |
||
| 160 | $tab = array(); |
||
| 161 | $tab = $root->toArray(); |
||
| 162 | $ret[] = $tab; |
||
| 163 | } |
||
| 164 | } |
||
| 165 | |||
| 166 | return $ret; |
||
| 167 | } |
||
| 168 | } |
||
| 169 |
If you suppress an error, we recommend checking for the error condition explicitly: