Issues (2687)

Security Analysis    not enabled

This project does not seem to handle request data directly as such no vulnerable execution paths were found.

  Cross-Site Scripting
Cross-Site Scripting enables an attacker to inject code into the response of a web-request that is viewed by other users. It can for example be used to bypass access controls, or even to take over other users' accounts.
  File Exposure
File Exposure allows an attacker to gain access to local files that he should not be able to access. These files can for example include database credentials, or other configuration files.
  File Manipulation
File Manipulation enables an attacker to write custom data to files. This potentially leads to injection of arbitrary code on the server.
  Object Injection
Object Injection enables an attacker to inject an object into PHP code, and can lead to arbitrary code execution, file exposure, or file manipulation attacks.
  Code Injection
Code Injection enables an attacker to execute arbitrary code on the server.
  Response Splitting
Response Splitting can be used to send arbitrary responses.
  File Inclusion
File Inclusion enables an attacker to inject custom files into PHP's file loading mechanism, either explicitly passed to include, or for example via PHP's auto-loading mechanism.
  Command Injection
Command Injection enables an attacker to inject a shell command that is execute with the privileges of the web-server. This can be used to expose sensitive data, or gain access of your server.
  SQL Injection
SQL Injection enables an attacker to execute arbitrary SQL code on your database server gaining access to user data, or manipulating user data.
  XPath Injection
XPath Injection enables an attacker to modify the parts of XML document that are read. If that XML document is for example used for authentication, this can lead to further vulnerabilities similar to SQL Injection.
  LDAP Injection
LDAP Injection enables an attacker to inject LDAP statements potentially granting permission to run unauthorized queries, or modify content inside the LDAP tree.
  Header Injection
  Other Vulnerability
This category comprises other attack vectors such as manipulating the PHP runtime, loading custom extensions, freezing the runtime, or similar.
  Regex Injection
Regex Injection enables an attacker to execute arbitrary code in your PHP process.
  XML Injection
XML Injection enables an attacker to read files on your local filesystem including configuration files, or can be abused to freeze your web-server process.
  Variable Injection
Variable Injection enables an attacker to overwrite program variables with custom data, and can lead to further vulnerabilities.
Unfortunately, the security analysis is currently not available for your project. If you are a non-commercial open-source project, please contact support to gain access.

src/Eccube/Repository/PaymentRepository.php (1 issue)

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
/*
4
 * This file is part of EC-CUBE
5
 *
6
 * Copyright(c) 2000-2015 LOCKON CO.,LTD. All Rights Reserved.
7
 *
8
 * http://www.lockon.co.jp/
9
 *
10
 * This program is free software; you can redistribute it and/or
11
 * modify it under the terms of the GNU General Public License
12
 * as published by the Free Software Foundation; either version 2
13
 * of the License, or (at your option) any later version.
14
 *
15
 * This program is distributed in the hope that it will be useful,
16
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18
 * GNU General Public License for more details.
19
 *
20
 * You should have received a copy of the GNU General Public License
21
 * along with this program; if not, write to the Free Software
22
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
23
 */
24
25
namespace Eccube\Repository;
26
27
use Doctrine\ORM\EntityRepository;
28
use Doctrine\ORM\Query;
29
30
/**
31
 * PaymentRepository
32
 *
33
 * This class was generated by the Doctrine ORM. Add your own custom
34
 * repository methods below.
35
 */
36
class PaymentRepository extends EntityRepository
37
{
38
39 11
    public function findOrCreate($id)
0 ignored issues
show
Missing function doc comment
Loading history...
40
    {
41 11
        if ($id == 0) {
42
43 8
            $Payment = $this->findOneBy(array(), array('rank' => 'DESC'));
44
45 8
            $rank = 1;
46 8
            if ($Payment) {
47 8
                $rank = $Payment->getRank() + 1;
48
            }
49
50 8
            $Payment = new \Eccube\Entity\Payment();
51
            $Payment
52 8
                ->setRank($rank)
53 8
                ->setDelFlg(0)
54 8
                ->setFixFlg(1)
55 8
                ->setChargeFlg(1);
56
        } else {
57 3
            $Payment = $this->find($id);
58
        }
59
60 11
        return $Payment;
61
    }
62
63 1
    public function findAllArray()
64
    {
65
66
        $query = $this
67 1
            ->getEntityManager()
68 1
            ->createQuery('SELECT p FROM Eccube\Entity\Payment p INDEX BY p.id');
69
        $result = $query
70 1
            ->getResult(Query::HYDRATE_ARRAY);
71
72 1
        return $result;
73
    }
74
75
    /**
76
     * 支払方法を取得
77
     * 条件によってはDoctrineのキャッシュが返されるため、arrayで結果を返すパターンも用意
78
     *
79
     * @param $delivery
80
     * @param $returnType true : Object、false: arrayが戻り値
81
     * @return array
82
     */
83 111
    public function findPayments($delivery, $returnType = false)
84
    {
85
86 111
        $query = $this->createQueryBuilder('p')
87 111
            ->innerJoin('Eccube\Entity\PaymentOption', 'po', 'WITH', 'po.payment_id = p.id')
88 111
            ->where('po.Delivery = (:delivery)')
89 111
            ->orderBy('p.rank', 'DESC')
90 111
            ->setParameter('delivery', $delivery)
91 111
            ->getQuery();
92
93 111
        $query->expireResultCache(false);
94
95 111
        if ($returnType) {
96 83
            $payments = $query->getResult();
97
        } else {
98 108
            $payments = $query->getArrayResult();
99
        }
100
101 111
        return $payments;
102
    }
103
104
    /**
105
     * 共通の支払方法を取得
106
     *
107
     * @param $deliveries
108
     * @return array
109
     */
110 108
    public function findAllowedPayments($deliveries)
111
    {
112 108
        $payments = array();
113 108
        $i = 0;
114
115 108
        foreach ($deliveries as $Delivery) {
116 107
            $p = $this->findPayments($Delivery);
117
118 107
            if ($i != 0) {
119
120 10
                $arr = array();
121 10
                foreach ($p as $payment) {
122 10
                    foreach ($payments as $pay) {
123 10
                        if ($payment['id'] == $pay['id']) {
124 8
                            $arr[] = $payment;
125 10
                            break;
126
                        }
127
                    }
128
                }
129
130 10
                $payments = $arr;
131
            } else {
132 107
                $payments = $p;
133
            }
134 108
            $i++;
135
        }
136
137 108
        return $payments;
138
    }
139
}
140