File tree Expand file tree Collapse file tree 1 file changed +83
-0
lines changed
Expand file tree Collapse file tree 1 file changed +83
-0
lines changed Original file line number Diff line number Diff line change 1+ <?php
2+
3+ /**
4+ * GNU General Public License (Version 2, June 1991)
5+ *
6+ * This program is free software; you can redistribute
7+ * it and/or modify it under the terms of the GNU
8+ * General Public License as published by the Free
9+ * Software Foundation; either version 2 of the License,
10+ * or (at your option) any later version.
11+ *
12+ * This program is distributed in the hope that it will
13+ * be useful, but WITHOUT ANY WARRANTY; without even the
14+ * implied warranty of MERCHANTABILITY or FITNESS FOR A
15+ * PARTICULAR PURPOSE. See the GNU General Public License
16+ * for more details.
17+ */
18+
19+ namespace Beeflow \SQLQueryManager \Vartypes ;
20+
21+ /**
22+ * Class BFPsqlSecureString
23+ *
24+ * @author Rafal Przetakowski <[email protected] > 25+ * @package Beeflow\SQLQueryManager\Vartypes
26+ */
27+ class BFPsqlSecureString
28+ {
29+ /**
30+ * Wartość zmienej
31+ *
32+ * @var Mixed
33+ */
34+ private $ value ;
35+
36+ /**
37+ * BFPsqlSecureString constructor.
38+ *
39+ * @param $value
40+ *
41+ * @throws \Exception
42+ */
43+ public function __construct ($ value )
44+ {
45+ $ value = strtr (strip_tags ($ value ),
46+ array (
47+ "' " => "'' " ,
48+ "\0" => "" ,
49+ "-- " => "" ,
50+ "); " => "" ,
51+ ") " => "" ,
52+ "} " => "" ,
53+ "( " => "" ,
54+ "( " => "" ,
55+ "<!-- " => "" ,
56+ "< " => "< " ,
57+ "> " => "> "
58+ // more secure
59+ ));
60+
61+ if (gettype ($ value ) == 'string ' ) {
62+ $ this ->value = $ value ;
63+ } else {
64+ throw new \Exception ('Value must be ' . __CLASS__ . ' type but is ' . gettype ($ value ));
65+ }
66+ }
67+
68+ /**
69+ * @return String
70+ */
71+ public function val ()
72+ {
73+ return $ this ->__toString ();
74+ }
75+
76+ /**
77+ * @return string
78+ */
79+ public function __toString ()
80+ {
81+ return (string )$ this ->value ;
82+ }
83+ }
You can’t perform that action at this time.
0 commit comments