Issues (100)

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.

scripts/migrate_patients.php (4 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
0 ignored issues
show
Coding Style Compatibility introduced by
For compatibility and reusability of your code, PSR1 recommends that a file should introduce either new symbols (like classes, functions, etc.) or have side-effects (like outputting something, or including other files), but not both at the same time. The first symbol is defined on line 28 and the first side effect is on line 29.

The PSR-1: Basic Coding Standard recommends that a file should either introduce new symbols, that is classes, functions, constants or similar, or have side effects. Side effects are anything that executes logic, like for example printing output, changing ini settings or writing to a file.

The idea behind this recommendation is that merely auto-loading a class should not change the state of an application. It also promotes a cleaner style of programming and makes your code less prone to errors, because the logic is not spread out all over the place.

To learn more about the PSR-1, please see the PHP-FIG site on the PSR-1.

Loading history...
2
/**
3
 * migrate
4
 *
5
 * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
6
 * OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
7
 *
8
 * Permission is hereby granted to use or copy this program
9
 * for any purpose, provided the above notices are retained on all copies.
10
 * Permission to modify the code and to distribute modified code is granted,
11
 * provided the above notices are retained, and a notice that the code was
12
 * modified is included with the above copyright notice.
13
 *
14
 * @category  Wp
15
 * @package   Punction
16
 * @author    Andrzej Marcinkowski <[email protected]>
17
 * @copyright 2014 Wojewódzki Szpital Zespolony, Kalisz
18
 * @license   MIT http://opensource.org/licenses/MIT
19
 * @version   1.0 $Id$ $Format:%H$
20
 * @link      http://
21
 * @since     File available since Release 1.0.0
22
 * PHP Version 5
23
 */
24
use Hospitalplugin\Entities\PatientZZ;
25
use Punction\DB\DoctrineBootstrap;
26
27
if (! defined ( 'ABSPATH' )) {
28
	define ( 'WP_USE_THEMES', false );
29
	require ('/var/www/wp/wp-load.php');
30
}
31
require_once ('/var/www/vendor/autoload.php');
32
Logger::configure ( '../resources/log4php.xml' );
33
/**
34
 * migration log4php logger
35
 */
36
$log = Logger::getLogger ( "migration" );
37
$log->info ( "Start!" );
38
39
global $wpdb;
0 ignored issues
show
Compatibility Best Practice introduced by
Use of global functionality is not recommended; it makes your code harder to test, and less reusable.

Instead of relying on global state, we recommend one of these alternatives:

1. Pass all data via parameters

function myFunction($a, $b) {
    // Do something
}

2. Create a class that maintains your state

class MyClass {
    private $a;
    private $b;

    public function __construct($a, $b) {
        $this->a = $a;
        $this->b = $b;
    }

    public function myFunction() {
        // Do something
    }
}
Loading history...
40
/**
41
 */
42
$query = "
43
        SELECT
44
            *
45
        FROM         $wpdb->posts
46
        WHERE
47
            post_type = 'pacjent'
48
            AND post_status = 'publish'
49
        ORDER BY
50
            post_title,
51
            post_date
52
        LIMIT    
53
        35000";
54
55
/**
56
 */
57
$error = "Error: the query failed...";
58
/**
59
 */
60
$results = $wpdb->get_results ( $query, ARRAY_A ) || wp_die ( $error );
61
62
$db1 = new DoctrineBootstrap ();
63
$entityManager = $db1->getEntityManager ();
64
65
foreach ( $results as $result ) {
0 ignored issues
show
The expression $results of type boolean is not traversable.
Loading history...
66
	/**
67
	 */
68
	$id = $result ['ID'];
69
	/**
70
	 */
71
	$title = $result ['post_title'];
72
	/**
73
	 */
74
	$pesel = implode ( get_post_meta ( $id, 'pesel' ) );
75
	/**
76
	 */
77
	$oddzid = implode ( get_post_meta ( $id, 'oddzial.ID' ) );
78
	/**
79
	 */
80
	
81
	$numer_historii = implode ( get_post_meta ( $id, 'numer_ksiegi_glownej' ) );
82
	/**
83
	 */
84
	$data_kategoryzacji = implode ( get_post_meta ( $id, 'data_kategoryzacji' ) );
85
	/**
86
	 */
87
	$kategoria_pacjenta = implode ( get_post_meta ( $id, 'kategoria_pacjenta' ) );
88
	/**
89
	 */
90
	$aktywnosc_fizyczna = implode ( get_post_meta ( $id, '1_aktywnosc_fizyczna' ) );
91
	/**
92
	 */
93
	$higiena = implode ( get_post_meta ( $id, '2_higiena' ) );
94
	/**
95
	 */
96
	$odzywianie = implode ( get_post_meta ( $id, '3_odzywianie' ) );
97
	/**
98
	 */
99
	$wydalanie = implode ( get_post_meta ( $id, '4_wydalanie' ) );
100
	/**
101
	 */
102
	$pomiar_objawow_zyciowych = implode ( get_post_meta ( $id, '5_pomiar_objawow_zyciowych' ) );
103
	/**
104
	 */
105
	$leczenie = implode ( get_post_meta ( $id, '6_leczenie' ) );
106
	/**
107
	 */
108
	$edukacja_i_wsparcie_psychiczne = implode ( get_post_meta ( $id, '7_edukacja_i_wsparcie_psychiczne' ) );
109
	
110
	/**
111
	 */
112
	$patient = new PatientZZ ();
0 ignored issues
show
The call to PatientZZ::__construct() misses a required argument $args.

This check looks for function calls that miss required arguments.

Loading history...
113
	$patient->setName ( $title );
114
	if ($data_kategoryzacji == null) {
115
		$log->warn ( "Patient " . $id . " missing date. Omitting." );
116
		continue;
117
	}
118
	$patient->setDataKategoryzacji ( \DateTime::createFromFormat ( "d-m-Y", $data_kategoryzacji ) );
119
	$patient->setOddzialId ( $oddzid );
120
	$patient->setNumerHistorii ( $numer_historii );
121
	
122
	$patient->setPesel ( $pesel );
123
	$patient->setKategoriaPacjenta ( $kategoria_pacjenta );
124
	$patient->setAktywnoscFizyczna ( $aktywnosc_fizyczna );
125
	$patient->setHigiena ( $higiena );
126
	$patient->setOdzywianie ( $odzywianie );
127
	$patient->setWydalanie ( $wydalanie );
128
	$patient->setPomiarObjawowZyciowych ( $pomiar_objawow_zyciowych );
129
	$patient->setLeczenie ( $leczenie );
130
	$patient->setEdukacjaIWsparciePsychiczne ( $edukacja_i_wsparcie_psychiczne );
131
	
132
	$entityManager->persist ( $patient );
133
}
134
$entityManager->flush ();
135
$log->info ( "Stop!" );
136