source: branches/1.2/workflow/inc/nano/NanoGuardian.class.php @ 1349

Revision 1349, 1.6 KB checked in by niltonneto, 15 years ago (diff)

Ticket #561 - Inclusão do módulo Workflow faltante nessa versão.

  • Property svn:executable set to *
Line 
1<?php
2
3/**
4 * NanoGuardian helps to secure user defined classes against XSS or
5 * SQL injection, etc.; it provides an easy to use interface to
6 * NanoSanitizer
7 *
8 * @package NanoAjax
9 *
10 */
11abstract class NanoGuardian
12{
13    /**
14     * holds a NanoSanitizer object
15     *
16     * @var NanoSanitizer
17     */
18    protected $_mObjNanoSanitizer;
19
20    /**
21     * holds signatures for unsafe parameter variables
22     *
23     * @var array
24     */
25    protected $_mArrSignatures = array();
26
27
28    /**
29     * a Constructor
30     *
31     */
32    public function __construct()
33    {
34        $this->_mObjNanoSanitizer = new NanoSanitizer(new DummyLogger);
35    }
36
37
38    /**
39     * Enter description here...
40     *
41     * @param array $params
42     */
43    protected function _getSanatizedParameter( $params = array() )
44    {
45        $this->_mObjNanoSanitizer->setErrorReporting(true);
46        $this->_mObjNanoSanitizer->loadPresets();
47        $this->_mObjNanoSanitizer->setSignatures($this->_mArrSignatures);
48
49        $this->_mObjNanoSanitizer->setUnSecureData($params);
50
51        return $this->_mObjNanoSanitizer->executeSanitization();
52    }
53
54
55    /**
56     * Enter description here...
57     *
58     * @param array $data
59     */
60    protected function _returnUtf8EncodedData( $data = array() )
61    {
62        array_walk_recursive($data,array($this,'_encodeUtf8'));
63        return $data;
64    }
65
66
67    /**
68     * Enter description here...
69     *
70     * @param mixed $item
71     * @param unknown_type $key
72     */
73    protected function _encodeUtf8( &$item, $key )
74    {
75        $item = utf8_encode($item);
76    }
77}
78
79?>
Note: See TracBrowser for help on using the repository browser.