GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( 3b3c73...aa7371 )
by Calima
04:29
created
Sistema/Ayudantes/CFPHPAyuda.php 2 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
     }
44 44
     
45 45
     
46
-     // filtros Email
46
+        // filtros Email
47 47
     
48 48
     function filtroEmail($email){
49 49
         if (!filter_input(INPUT_POST, $email, FILTER_VALIDATE_EMAIL)){
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
     //texto
110 110
     public function filtrarEntero($int){
111 111
         
112
-       return filter_var($int, FILTER_VALIDATE_INT);
112
+        return filter_var($int, FILTER_VALIDATE_INT);
113 113
        
114 114
     }
115 115
     
Please login to merge, or discard this patch.
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -36,17 +36,17 @@  discard block
 block discarded – undo
36 36
     public function __construct() {
37 37
         //parent::__construct();
38 38
     
39
-    $this->_sesion=new \Sistema\Nucleo\CFSesion();
39
+    $this->_sesion = new \Sistema\Nucleo\CFSesion();
40 40
     }
41
-    public function enviarCorreo($para, $titulo= 'Asunto', $mensaje= 'cuerpo del correo'){
41
+    public function enviarCorreo($para, $titulo = 'Asunto', $mensaje = 'cuerpo del correo') {
42 42
         return mail($para, $titulo, $mensaje);
43 43
     }
44 44
     
45 45
     
46 46
      // filtros Email
47 47
     
48
-    function filtroEmail($email){
49
-        if (!filter_input(INPUT_POST, $email, FILTER_VALIDATE_EMAIL)){
48
+    function filtroEmail($email) {
49
+        if (!filter_input(INPUT_POST, $email, FILTER_VALIDATE_EMAIL)) {
50 50
             echo "E-Mail no es valido";
51 51
         }
52 52
         else
@@ -58,44 +58,44 @@  discard block
 block discarded – undo
58 58
     
59 59
     //cadenas
60 60
     
61
-    function rangoTexto($texto, $inicio, $cantidad){
61
+    function rangoTexto($texto, $inicio, $cantidad) {
62 62
         
63
-        return $limite= substr($texto, $inicio, $cantidad); 
63
+        return $limite = substr($texto, $inicio, $cantidad); 
64 64
         
65 65
     }
66 66
     
67 67
     //Redirecionar
68 68
     
69
-    function Redireccion($url, $permanent = false){
69
+    function Redireccion($url, $permanent = false) {
70 70
     header('Location: ' . $url, true, $permanent ? 301 : 302);
71 71
 
72 72
     exit();
73 73
     }
74 74
     
75
-    function redireccionUrl($url){
76
-        $url=Cf_BASE_URL.$url;
75
+    function redireccionUrl($url) {
76
+        $url = Cf_BASE_URL . $url;
77 77
     header('Location: ' . $url);
78 78
     exit();
79 79
     }
80 80
     
81
-    function redireccionUrlMsj($controlador){
81
+    function redireccionUrlMsj($controlador) {
82 82
         $this->_sesion->iniciarSesion('_s', false);
83
-        $_SESSION[error_ingreso]='Error en el intento de ingreso';
84
-        $controlador=Cf_BASE_URL.$controlador;
83
+        $_SESSION[error_ingreso] = 'Error en el intento de ingreso';
84
+        $controlador = Cf_BASE_URL . $controlador;
85 85
     header('Location: ' . $controlador);
86 86
     exit();
87 87
     }
88 88
     
89
-    function redireccion_($url, $statusCode = 303){
89
+    function redireccion_($url, $statusCode = 303) {
90 90
     header('Location: ' . $url, true, $statusCode);
91 91
     die();
92 92
     }
93 93
     
94
-    function redirect($controller,$method = "index",$args = array())
94
+    function redirect($controller, $method = "index", $args = array())
95 95
 {
96 96
     global $core; /* Guess Obviously */
97 97
 
98
-    $location = $core->Cf_BASE_URL . "/" . $controller . "/" . $method . "/" . implode("/",$args);
98
+    $location = $core->Cf_BASE_URL . "/" . $controller . "/" . $method . "/" . implode("/", $args);
99 99
 
100 100
     /*
101 101
         * Use @header to redirect the page:
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
     
108 108
     
109 109
     //texto
110
-    public function filtrarEntero($int){
110
+    public function filtrarEntero($int) {
111 111
         
112 112
        return filter_var($int, FILTER_VALIDATE_INT);
113 113
        
Please login to merge, or discard this patch.
Sistema/Ayudantes/CFPHPCache.php 2 patches
Indentation   +95 added lines, -95 removed lines patch added patch discarded remove patch
@@ -26,100 +26,100 @@
 block discarded – undo
26 26
 namespace Sistema\Ayudantes;
27 27
 
28 28
 class CFPHPCache {
29
-	/**
30
-	 * Configuracion
31
-	 *
32
-	 * @access public
33
-	 */
34
-	public static $configuracion = array(
35
-		'cache_dir' => 'cache',
36
-		// por defecto el tiempo expira en  *minutos*
37
-		'expires' => 180,
38
-	);
29
+    /**
30
+     * Configuracion
31
+     *
32
+     * @access public
33
+     */
34
+    public static $configuracion = array(
35
+        'cache_dir' => 'cache',
36
+        // por defecto el tiempo expira en  *minutos*
37
+        'expires' => 180,
38
+    );
39 39
 	
40
-	public static function configurar($clave, $valor = null) {
41
-		if( is_array($clave) ) {
42
-			foreach ($clave as $config_name => $config_value) {
43
-				self::$configuracion[$config_name] = $config_value;
44
-			}
45
-		} else {
46
-			self::$configuracion[$clave] = $valor;
47
-		}
48
-	}
49
-	/**
50
-	 * obtiene la ruta del archivo asociado a la clave.
51
-	 *
52
-	 * @access public
53
-	 * @param string $clave
54
-	 * @return string el nombre del archivo php
55
-	 */
56
-	public static function obtenerRuta($clave) {
57
-		return static::$configuracion['cache_path'] . '/' . md5($clave) . '.php';
58
-	}
59
-	/**
60
-	 * obtiene los datos asociados a la clave
61
-	 *
62
-	 * @access public
63
-	 * @param string $clave	 
64
-	 */
65
-	public static function obtener($clave, $raw = false, $tiempo_personalizado = null) {
66
-		if( ! self::file_expired($archivo = self::obtenerRuta($clave), $tiempo_personalizado)) {
67
-			$contenido = file_get_contents($archivo);
68
-			return $raw ? $contenido : unserialize($contenido);
69
-		}
70
-		return null;
71
-	}
72
-	/**
73
-	 * Envia el contenido dentro de la cache
74
-	 *
75
-	 * @access public
76
-	 * @param string $clave
77
-	 * @param mixed $content the the content you want to store
78
-	 * @param bool $raw whether if you want to store raw data or not. If it is true, $content *must* be a string
79
-	 *        It can be useful for static html caching.
80
-	 * @return bool whether if the operation was successful or not
81
-	 */
82
-	public static function enviar($clave, $contenido, $raw = false) {
83
-		return @file_put_contents(self::obtenerRuta($clave), $raw ? $contenido : serialize($contenido)) !== false;
84
-	}
85
-	/**
86
-	 * Delete data from cache
87
-	 *
88
-	 * @access public
89
-	 * @param string $clave
90
-	 * @return bool true if the data was removed successfully
91
-	 */
92
-	public static function eliminar($clave) {
93
-		if( ! file_exists($archivo = self::obtenerRuta($clave)) ) {
94
-			return true;
95
-		}
96
-		return @unlink($archivo);
97
-	}
98
-	/**
99
-	 * limpia la cache
100
-	 *
101
-	 * @access public
102
-	 * @return bool always true
103
-	 */
104
-	public static function limpiar() {
105
-		$cache_files = glob(self::$configuracion['cache_path'] . '/*.php', GLOB_NOSORT);
106
-		foreach ($cache_files as $archivo) {
107
-			@unlink($archivo);
108
-		}
109
-		return true;
110
-	}
111
-	/**
112
-	 * Check if a file has expired or not.
113
-	 *
114
-	 * @access public
115
-	 * @param $archivo the rout to the file
116
-	 * @param int $fecha the number of minutes it was set to expire
117
-	 * @return bool if the file has expired or not
118
-	 */
119
-	public static function file_expired($archivo, $fecha = null) {
120
-		if( ! file_exists($archivo) ) {
121
-			return true;
122
-		}
123
-		return (time() > (filemtime($archivo) + 60 * ($fecha ? $fecha : self::$configuracion['expires'])));
124
-	}
40
+    public static function configurar($clave, $valor = null) {
41
+        if( is_array($clave) ) {
42
+            foreach ($clave as $config_name => $config_value) {
43
+                self::$configuracion[$config_name] = $config_value;
44
+            }
45
+        } else {
46
+            self::$configuracion[$clave] = $valor;
47
+        }
48
+    }
49
+    /**
50
+     * obtiene la ruta del archivo asociado a la clave.
51
+     *
52
+     * @access public
53
+     * @param string $clave
54
+     * @return string el nombre del archivo php
55
+     */
56
+    public static function obtenerRuta($clave) {
57
+        return static::$configuracion['cache_path'] . '/' . md5($clave) . '.php';
58
+    }
59
+    /**
60
+     * obtiene los datos asociados a la clave
61
+     *
62
+     * @access public
63
+     * @param string $clave	 
64
+     */
65
+    public static function obtener($clave, $raw = false, $tiempo_personalizado = null) {
66
+        if( ! self::file_expired($archivo = self::obtenerRuta($clave), $tiempo_personalizado)) {
67
+            $contenido = file_get_contents($archivo);
68
+            return $raw ? $contenido : unserialize($contenido);
69
+        }
70
+        return null;
71
+    }
72
+    /**
73
+     * Envia el contenido dentro de la cache
74
+     *
75
+     * @access public
76
+     * @param string $clave
77
+     * @param mixed $content the the content you want to store
78
+     * @param bool $raw whether if you want to store raw data or not. If it is true, $content *must* be a string
79
+     *        It can be useful for static html caching.
80
+     * @return bool whether if the operation was successful or not
81
+     */
82
+    public static function enviar($clave, $contenido, $raw = false) {
83
+        return @file_put_contents(self::obtenerRuta($clave), $raw ? $contenido : serialize($contenido)) !== false;
84
+    }
85
+    /**
86
+     * Delete data from cache
87
+     *
88
+     * @access public
89
+     * @param string $clave
90
+     * @return bool true if the data was removed successfully
91
+     */
92
+    public static function eliminar($clave) {
93
+        if( ! file_exists($archivo = self::obtenerRuta($clave)) ) {
94
+            return true;
95
+        }
96
+        return @unlink($archivo);
97
+    }
98
+    /**
99
+     * limpia la cache
100
+     *
101
+     * @access public
102
+     * @return bool always true
103
+     */
104
+    public static function limpiar() {
105
+        $cache_files = glob(self::$configuracion['cache_path'] . '/*.php', GLOB_NOSORT);
106
+        foreach ($cache_files as $archivo) {
107
+            @unlink($archivo);
108
+        }
109
+        return true;
110
+    }
111
+    /**
112
+     * Check if a file has expired or not.
113
+     *
114
+     * @access public
115
+     * @param $archivo the rout to the file
116
+     * @param int $fecha the number of minutes it was set to expire
117
+     * @return bool if the file has expired or not
118
+     */
119
+    public static function file_expired($archivo, $fecha = null) {
120
+        if( ! file_exists($archivo) ) {
121
+            return true;
122
+        }
123
+        return (time() > (filemtime($archivo) + 60 * ($fecha ? $fecha : self::$configuracion['expires'])));
124
+    }
125 125
 }
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
 	);
39 39
 	
40 40
 	public static function configurar($clave, $valor = null) {
41
-		if( is_array($clave) ) {
41
+		if (is_array($clave)) {
42 42
 			foreach ($clave as $config_name => $config_value) {
43 43
 				self::$configuracion[$config_name] = $config_value;
44 44
 			}
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 	 * @param string $clave	 
64 64
 	 */
65 65
 	public static function obtener($clave, $raw = false, $tiempo_personalizado = null) {
66
-		if( ! self::file_expired($archivo = self::obtenerRuta($clave), $tiempo_personalizado)) {
66
+		if (!self::file_expired($archivo = self::obtenerRuta($clave), $tiempo_personalizado)) {
67 67
 			$contenido = file_get_contents($archivo);
68 68
 			return $raw ? $contenido : unserialize($contenido);
69 69
 		}
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
 	 * @return bool true if the data was removed successfully
91 91
 	 */
92 92
 	public static function eliminar($clave) {
93
-		if( ! file_exists($archivo = self::obtenerRuta($clave)) ) {
93
+		if (!file_exists($archivo = self::obtenerRuta($clave))) {
94 94
 			return true;
95 95
 		}
96 96
 		return @unlink($archivo);
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
 	 * @return bool if the file has expired or not
118 118
 	 */
119 119
 	public static function file_expired($archivo, $fecha = null) {
120
-		if( ! file_exists($archivo) ) {
120
+		if (!file_exists($archivo)) {
121 121
 			return true;
122 122
 		}
123 123
 		return (time() > (filemtime($archivo) + 60 * ($fecha ? $fecha : self::$configuracion['expires'])));
Please login to merge, or discard this patch.
Sistema/Ayudantes/CFPHPFormularios.php 2 patches
Indentation   +823 added lines, -823 removed lines patch added patch discarded remove patch
@@ -25,26 +25,26 @@  discard block
 block discarded – undo
25 25
 
26 26
 // se agradece a ArrayZone por el aporte de esta clase
27 27
 
28
- /**
29
- * @name Form Generator for Kernel Web
30
- * @version A.1.0
31
- * @copyright ArrayZone 2014
32
- * @license AZPL or later; see License.txt or http://arrayzone.com/license
33
- * @category plugin
34
- * 
35
- * Description: This script write a FORM HTML automatically from array (it will be generated trhoug functions).
36
- * It write any type of items basics of HTML4 and some of HTML5.
37
- * Once user clic "submit", all information  will be validated via PHP
38
- * Some types like "required" and "email" validated trhough PHP to avoid problems with navigator compatibilities or hacker attacks
39
- *
40
- * NEXT VERSION: If you can use JavaScript and have JQuery implemented, the form can write JavaScript code to validate all
41
- * Read the documentation for all information in kernel.arrayzone.com
42
- * or all coments of all parameters and functions.
43
- * 
44
- * IMPORTANT: If you use a specific system to get POST and GET, you have to edit "private function getData()"
45
- * IMPORTANT 2: If you use DISABLE, control it manually when you save it
46
- * IMPORTANT 3: Currently aren't supported array names (name="MyField[]"), you can use: name="MyField_1"
47
- */
28
+    /**
29
+     * @name Form Generator for Kernel Web
30
+     * @version A.1.0
31
+     * @copyright ArrayZone 2014
32
+     * @license AZPL or later; see License.txt or http://arrayzone.com/license
33
+     * @category plugin
34
+     * 
35
+     * Description: This script write a FORM HTML automatically from array (it will be generated trhoug functions).
36
+     * It write any type of items basics of HTML4 and some of HTML5.
37
+     * Once user clic "submit", all information  will be validated via PHP
38
+     * Some types like "required" and "email" validated trhough PHP to avoid problems with navigator compatibilities or hacker attacks
39
+     *
40
+     * NEXT VERSION: If you can use JavaScript and have JQuery implemented, the form can write JavaScript code to validate all
41
+     * Read the documentation for all information in kernel.arrayzone.com
42
+     * or all coments of all parameters and functions.
43
+     * 
44
+     * IMPORTANT: If you use a specific system to get POST and GET, you have to edit "private function getData()"
45
+     * IMPORTANT 2: If you use DISABLE, control it manually when you save it
46
+     * IMPORTANT 3: Currently aren't supported array names (name="MyField[]"), you can use: name="MyField_1"
47
+     */
48 48
 
49 49
  
50 50
  
@@ -52,855 +52,855 @@  discard block
 block discarded – undo
52 52
 
53 53
 class CFPHPFormularios
54 54
 {
55
-	/*
55
+    /*
56 56
 	 * Form configuration. It don't need description
57 57
 	 */
58
-	public $method = 'post'; // post / get (CAUTION!!: Case sensitive)
59
-	public $action = '';
60
-	public $name = '';
61
-	public $on_submit = '';
62
-	public $id = '';
63
-	public $class = '';
64
-	
65
-	/**
66
-	 * Logging control
67
-	 * @logErrors boolean If is true, $errors will store errors
68
-	 * @errors string Contain al errors
69
-	 */
70
-	public $logErrors = true;
71
-	public $errors = '';
72
-	
73
-	/*
58
+    public $method = 'post'; // post / get (CAUTION!!: Case sensitive)
59
+    public $action = '';
60
+    public $name = '';
61
+    public $on_submit = '';
62
+    public $id = '';
63
+    public $class = '';
64
+	
65
+    /**
66
+     * Logging control
67
+     * @logErrors boolean If is true, $errors will store errors
68
+     * @errors string Contain al errors
69
+     */
70
+    public $logErrors = true;
71
+    public $errors = '';
72
+	
73
+    /*
74 74
 	 * Other configurations about form
75 75
 	 */
76 76
 	
77
-	/**
78
-	 * @show_labels boolean
79
-	 * @tutorial If is true, it show label text of some inputs before input tag
80
-	 */
81
-	public $show_labels = true;
77
+    /**
78
+     * @show_labels boolean
79
+     * @tutorial If is true, it show label text of some inputs before input tag
80
+     */
81
+    public $show_labels = true;
82 82
 	
83
-	/** IN DEVELOPMENT
84
-	 * @self_show boolean
85
-	 * @tutorial if is true, it show the input when function addX is called
86
-	 */
87
-	//public $self_show = false;
83
+    /** IN DEVELOPMENT
84
+     * @self_show boolean
85
+     * @tutorial if is true, it show the input when function addX is called
86
+     */
87
+    //public $self_show = false;
88 88
 	
89 89
 	
90
-	/** IN DEVELOPMENT
91
-	 * @only_show boolean
92
-	 * @tutorial If is true, it don't save the configuration to input (so showForm() and validateData() don't work)
93
-	 */
94
-	//public $only_show = false;
90
+    /** IN DEVELOPMENT
91
+     * @only_show boolean
92
+     * @tutorial If is true, it don't save the configuration to input (so showForm() and validateData() don't work)
93
+     */
94
+    //public $only_show = false;
95 95
 
96 96
 	
97
-	/*
97
+    /*
98 98
 	 * Content
99 99
 	 * It can be set manually or automatically trhough functions
100 100
 	 */
101
-	public $content = array();
101
+    public $content = array();
102 102
 	
103 103
 /*
104 104
  * Start functions
105 105
  */
106 106
 	
107
-	/**
108
-	 * @name showArray
109
-	 * @tutorial This function show array result, it can be copied and you can replace all generator functions to this array
110
-	 * @example $fg->showArray();
111
-	 */
112
-	public function showArray($array = false) {
113
-		print_r($this->content);
114
-	}
115
-	
116
-	
117
-	/**
118
-	 * @name showForm
119
-	 * @tutorial This function generate the form
120
-	 * @example $fg->showForm();
121
-	 */
122
-	public function showForm() {
123
-		// Loading all arrays
124
-		$toShow = $this->content;
125
-		
126
-		// Showing form
127
-		echo $this->showStartForm();
128
-		
129
-		
130
-		// Itearate all inputs
131
-		foreach ($toShow as $input) {
132
-			// Reading data
133
-			if (isset($input['data'])) $data = $input['data'];
107
+    /**
108
+     * @name showArray
109
+     * @tutorial This function show array result, it can be copied and you can replace all generator functions to this array
110
+     * @example $fg->showArray();
111
+     */
112
+    public function showArray($array = false) {
113
+        print_r($this->content);
114
+    }
115
+	
116
+	
117
+    /**
118
+     * @name showForm
119
+     * @tutorial This function generate the form
120
+     * @example $fg->showForm();
121
+     */
122
+    public function showForm() {
123
+        // Loading all arrays
124
+        $toShow = $this->content;
125
+		
126
+        // Showing form
127
+        echo $this->showStartForm();
128
+		
129
+		
130
+        // Itearate all inputs
131
+        foreach ($toShow as $input) {
132
+            // Reading data
133
+            if (isset($input['data'])) $data = $input['data'];
134 134
 			
135
-			// New row
136
-			echo '<div>';
137
-				// Showing labels
138
-				if ($this->show_labels) {
139
-					echo '<div>';
140
-						if (isset($input['label']) and $input['label'] != '') echo $input['label'];
141
-					echo '</div>';
142
-				}
135
+            // New row
136
+            echo '<div>';
137
+                // Showing labels
138
+                if ($this->show_labels) {
139
+                    echo '<div>';
140
+                        if (isset($input['label']) and $input['label'] != '') echo $input['label'];
141
+                    echo '</div>';
142
+                }
143 143
 				
144
-				// Showing content
145
-				echo '<div>';		
146
-					switch ($input['type']) {
147
-						case 'input':
148
-							echo $this->showInput($data);
149
-							break;
150
-						case 'radio':
151
-							echo $this->showRadio($data, $input['values'], $input['selected']);
152
-							break;
153
-						case 'select';
154
-							echo $this->showSelect($data, $input['values'], $input['selected']);
155
-							break;
156
-						case 'textarea':
157
-							echo $this->showTextArea($input['text'], $data);
158
-							break;
159
-						case 'separator';
160
-							echo '<br />';
161
-							break;
162
-					}
163
-				echo '</div>';
164
-			echo '</div>'.PHP_EOL;
165
-		}
166
-		
167
-		// Closing form
168
-		echo $this->showEndForm();
169
-	}
170
-	
171
-	
172
-	/* 
144
+                // Showing content
145
+                echo '<div>';		
146
+                    switch ($input['type']) {
147
+                        case 'input':
148
+                            echo $this->showInput($data);
149
+                            break;
150
+                        case 'radio':
151
+                            echo $this->showRadio($data, $input['values'], $input['selected']);
152
+                            break;
153
+                        case 'select';
154
+                            echo $this->showSelect($data, $input['values'], $input['selected']);
155
+                            break;
156
+                        case 'textarea':
157
+                            echo $this->showTextArea($input['text'], $data);
158
+                            break;
159
+                        case 'separator';
160
+                            echo '<br />';
161
+                            break;
162
+                    }
163
+                echo '</div>';
164
+            echo '</div>'.PHP_EOL;
165
+        }
166
+		
167
+        // Closing form
168
+        echo $this->showEndForm();
169
+    }
170
+	
171
+	
172
+    /* 
173 173
 	 * The following "showX" functions are autoloaded and show the different parts of form
174 174
 	 */ 
175 175
 	
176
-	/**
177
-	 * @name showInput
178
-	 * @tutorial This function show <input> tag with parameters specifics
179
-	 * @param array $data All data to show in the input
180
-	 * @return string
181
-	 */
182
-	private function showInput($data) {
183
-		$r = '';
184
-		// Number start if is range
185
-		if ($data['type'] == 'range' and isset($data['min'])) $r .= $data['min'] . ' '; 
176
+    /**
177
+     * @name showInput
178
+     * @tutorial This function show <input> tag with parameters specifics
179
+     * @param array $data All data to show in the input
180
+     * @return string
181
+     */
182
+    private function showInput($data) {
183
+        $r = '';
184
+        // Number start if is range
185
+        if ($data['type'] == 'range' and isset($data['min'])) $r .= $data['min'] . ' '; 
186 186
 		
187
-		$r .= '<input ';
187
+        $r .= '<input ';
188 188
 		
189
-		// Reading value sended by user, if are any, we load it temporaly to show in form
190
-		$data['value'] = $this->getData($data['name'], $data['value']);
189
+        // Reading value sended by user, if are any, we load it temporaly to show in form
190
+        $data['value'] = $this->getData($data['name'], $data['value']);
191 191
 		
192
-		// Asignamos las claves conviritiendo el array
193
-		foreach ($data as $attr=>$value) {
194
-			$r .= $attr.'="'.$value.'" ';
195
-		}
192
+        // Asignamos las claves conviritiendo el array
193
+        foreach ($data as $attr=>$value) {
194
+            $r .= $attr.'="'.$value.'" ';
195
+        }
196 196
 		
197
-		$r .= '/>';
197
+        $r .= '/>';
198 198
 		
199
-		// Number end if is range
200
-		if ($data['type'] == 'range' and isset($data['max'])) $r .= $data['max'] . ' ';
199
+        // Number end if is range
200
+        if ($data['type'] == 'range' and isset($data['max'])) $r .= $data['max'] . ' ';
201 201
 		
202
-		// Return
203
-		return $r;
204
-	}
202
+        // Return
203
+        return $r;
204
+    }
205 205
 	
206
-	private function showRadio($data, $values, $selected) {		
207
-		// Primero generamos un esquema
208
-		$base = '<label><input type="radio"';
206
+    private function showRadio($data, $values, $selected) {		
207
+        // Primero generamos un esquema
208
+        $base = '<label><input type="radio"';
209 209
 		
210
-		// Asignamos las claves conviritiendo el array
211
-		foreach ($data as $attr=>$value) {
212
-			$base .= $attr.'="'.$value.'" ';
213
-		}
210
+        // Asignamos las claves conviritiendo el array
211
+        foreach ($data as $attr=>$value) {
212
+            $base .= $attr.'="'.$value.'" ';
213
+        }
214 214
 		
215 215
 		
216
-		// Leemos el valor enviado por el usuario (si lo hay) y si hay, reemplazamos $select por el valor 
217
-		$selected = $this->getData($data['name'], $selected);
216
+        // Leemos el valor enviado por el usuario (si lo hay) y si hay, reemplazamos $select por el valor 
217
+        $selected = $this->getData($data['name'], $selected);
218 218
 
219
-		//echo $sendValue;
220
-		// Si no tiene m�ltiples valores (es un string), lo retornamos de golpe 
221
-		if (!is_array($values)) {
222
-			// Comprobamos el value, es posible que el usuario este intentando crear los Radio (option) de forma separada
223
-			if (!is_array($values) and $selected == $values) $base .= ' checked="checked" ';
224
-			return $base . ' value="'.$values.'" />';
225
-		} 
219
+        //echo $sendValue;
220
+        // Si no tiene m�ltiples valores (es un string), lo retornamos de golpe 
221
+        if (!is_array($values)) {
222
+            // Comprobamos el value, es posible que el usuario este intentando crear los Radio (option) de forma separada
223
+            if (!is_array($values) and $selected == $values) $base .= ' checked="checked" ';
224
+            return $base . ' value="'.$values.'" />';
225
+        } 
226 226
 
227
-		// Por el contrario, tenemos 1 o m�s value con lo que es un posible texto
228
-		// Ahora preparamos todos los input
229
-		$r = '';
230
-		foreach ($values as $id=>$text) {
231
-			$r .= $base;
232
-			if ($selected !== null and $id == $selected) $r .= ' checked="checked" ';
233
-			$r .= ' value="'. $id .'" />'.$text.'</label>';
234
-		}
235
-		
236
-		return $r;
237
-		
238
-	}
239
-	
240
-	/**
241
-	 * @name showSelect
242
-	 * @tutorial This function show <select> tag with all values
243
-	 * @param array $data All data to show in the input
244
-	 * @param array $values Values to show in select
245
-	 * @param string $selected Specify selected option
246
-	 * @return string
247
-	 */
248
-	private function showSelect($data, $values, $selected = null) {
249
-		$r = '<select ';
250
-			// Convert array to input string
251
-			foreach ($data as $attr=>$value) {
252
-				$r .= $attr.'="'.$value.'" ';
253
-			}
254
-			// Return end input
255
-		$r .= '>';
256
-		
257
-		// Leemos el valor enviado por el usuario (si lo hay) y si hay, reemplazamos $select por el valor
258
-		$selected = $this->getData($data['name'], $selected);
259
-		
260
-		
261
-		// Loading options
262
-		// To speed up processes, we have two whiles depending if are any selected value
263
-		if ($selected != '') {
264
-			foreach ($values as $val=>$txt) {
265
-				$r .= '<option value="' . $val . '"';
266
-					if ($val == $selected) $r .= ' selected ';
267
-				$r .= '>' . $txt . '</option>';
268
-			}
269
-		} else {
270
-			foreach ($values as $val=>$txt) {
271
-				$r .= '<option value="' . $val . '">' . $txt . '</option>';
272
-			}	
273
-		}
274
-		
275
-		return $r . '</select>';
276
-	}
277
-	
278
-	/**
279
-	 * @name showTextArea
280
-	 * @tutorial This function show <textarea> tag with all values
281
-	 * @param array $data All data to show in the input
282
-	 * @return string
283
-	 */
284
-	private function showTextArea($text, $data) {
285
-		$r = '';
286
-		$r .= '<textarea ';
287
-		
288
-		// Asignamos las claves conviritiendo el array
289
-		foreach ($data as $attr=>$value) {
290
-			$r .= $attr.'="'.$value.'" ';
291
-		}
292
-		
293
-		$r .= '>';
294
-		// Reading value sended by user, if are any, we load it temporaly to show in form
295
-		$r .= $this->getData($data['name'], $text) . '</textarea>';
227
+        // Por el contrario, tenemos 1 o m�s value con lo que es un posible texto
228
+        // Ahora preparamos todos los input
229
+        $r = '';
230
+        foreach ($values as $id=>$text) {
231
+            $r .= $base;
232
+            if ($selected !== null and $id == $selected) $r .= ' checked="checked" ';
233
+            $r .= ' value="'. $id .'" />'.$text.'</label>';
234
+        }
235
+		
236
+        return $r;
237
+		
238
+    }
239
+	
240
+    /**
241
+     * @name showSelect
242
+     * @tutorial This function show <select> tag with all values
243
+     * @param array $data All data to show in the input
244
+     * @param array $values Values to show in select
245
+     * @param string $selected Specify selected option
246
+     * @return string
247
+     */
248
+    private function showSelect($data, $values, $selected = null) {
249
+        $r = '<select ';
250
+            // Convert array to input string
251
+            foreach ($data as $attr=>$value) {
252
+                $r .= $attr.'="'.$value.'" ';
253
+            }
254
+            // Return end input
255
+        $r .= '>';
256
+		
257
+        // Leemos el valor enviado por el usuario (si lo hay) y si hay, reemplazamos $select por el valor
258
+        $selected = $this->getData($data['name'], $selected);
259
+		
260
+		
261
+        // Loading options
262
+        // To speed up processes, we have two whiles depending if are any selected value
263
+        if ($selected != '') {
264
+            foreach ($values as $val=>$txt) {
265
+                $r .= '<option value="' . $val . '"';
266
+                    if ($val == $selected) $r .= ' selected ';
267
+                $r .= '>' . $txt . '</option>';
268
+            }
269
+        } else {
270
+            foreach ($values as $val=>$txt) {
271
+                $r .= '<option value="' . $val . '">' . $txt . '</option>';
272
+            }	
273
+        }
274
+		
275
+        return $r . '</select>';
276
+    }
277
+	
278
+    /**
279
+     * @name showTextArea
280
+     * @tutorial This function show <textarea> tag with all values
281
+     * @param array $data All data to show in the input
282
+     * @return string
283
+     */
284
+    private function showTextArea($text, $data) {
285
+        $r = '';
286
+        $r .= '<textarea ';
287
+		
288
+        // Asignamos las claves conviritiendo el array
289
+        foreach ($data as $attr=>$value) {
290
+            $r .= $attr.'="'.$value.'" ';
291
+        }
292
+		
293
+        $r .= '>';
294
+        // Reading value sended by user, if are any, we load it temporaly to show in form
295
+        $r .= $this->getData($data['name'], $text) . '</textarea>';
296 296
 
297
-		// Return
298
-		return $r;
299
-	}
300
-	
301
-	/**
302
-	 * @name showStartForm This function return the start part of the form
303
-	 * @return string
304
-	 */
305
-	private function showStartForm() {
306
-		$r = '<form ';
307
-		if ($this->action!= '') $r .= 'action="'.$this->action.'" ';
308
-		if ($this->method != '') $r .= 'method="'.$this->method .'" ';
309
-		if ($this->name != '') $r .= 'name="'.$this->name .'" ';
310
-		if ($this->on_submit != '') $r .= 'onSubmit="'.$this->on_submit  .'" ';
311
-		if ($this->id != '') $r .= 'id="'.$this->id .'" ';
312
-		if ($this->class != '') $r .= 'class="'.$this->class .'" ';
313
-	
314
-		return $r . '>'.PHP_EOL;
315
-	}
316
-	
317
-	/**
318
-	 * @name showEndForm This show the end of the form
319
-	 * @return string
320
-	 */
321
-	private function showEndForm() {
322
-		return '</form>';
323
-	}
324
-	
325
-	
326
-	/*
297
+        // Return
298
+        return $r;
299
+    }
300
+	
301
+    /**
302
+     * @name showStartForm This function return the start part of the form
303
+     * @return string
304
+     */
305
+    private function showStartForm() {
306
+        $r = '<form ';
307
+        if ($this->action!= '') $r .= 'action="'.$this->action.'" ';
308
+        if ($this->method != '') $r .= 'method="'.$this->method .'" ';
309
+        if ($this->name != '') $r .= 'name="'.$this->name .'" ';
310
+        if ($this->on_submit != '') $r .= 'onSubmit="'.$this->on_submit  .'" ';
311
+        if ($this->id != '') $r .= 'id="'.$this->id .'" ';
312
+        if ($this->class != '') $r .= 'class="'.$this->class .'" ';
313
+	
314
+        return $r . '>'.PHP_EOL;
315
+    }
316
+	
317
+    /**
318
+     * @name showEndForm This show the end of the form
319
+     * @return string
320
+     */
321
+    private function showEndForm() {
322
+        return '</form>';
323
+    }
324
+	
325
+	
326
+    /*
327 327
 	 * VALIDATORS
328 328
 	 */
329
-	/**
330
-	 * @name validate
331
-	 * @tutorial this function validate items sends trhough form. It DON'T FILTER
332
-	 * 	Basically simulate HTML5 trhoguh PHP for full compatibility
333
-	 * @param boolean $error_list If is true, it generate in $this->error_list a list with data required 
334
-	 */
335
-	public function validate() {
336
-		$this->error_list = ''; // Clean error list
337
-		$total = 0; // Total counted params
338
-		$success = 0; // Total correct
339
-		
340
-		// load all inputs
341
-		$params = $this->content;
342
-		
343
-		// reading all inputs
344
-		foreach ($params as $param) {
345
-			++$total;
329
+    /**
330
+     * @name validate
331
+     * @tutorial this function validate items sends trhough form. It DON'T FILTER
332
+     * 	Basically simulate HTML5 trhoguh PHP for full compatibility
333
+     * @param boolean $error_list If is true, it generate in $this->error_list a list with data required 
334
+     */
335
+    public function validate() {
336
+        $this->error_list = ''; // Clean error list
337
+        $total = 0; // Total counted params
338
+        $success = 0; // Total correct
339
+		
340
+        // load all inputs
341
+        $params = $this->content;
342
+		
343
+        // reading all inputs
344
+        foreach ($params as $param) {
345
+            ++$total;
346 346
 			
347
-			// Skip separators and bad generated arrays
348
-			if (!isset($param['data'])) {
349
-				++$success;
350
-				continue;
351
-			}
347
+            // Skip separators and bad generated arrays
348
+            if (!isset($param['data'])) {
349
+                ++$success;
350
+                continue;
351
+            }
352 352
 			
353
-			// Start validation
354
-			$data = $param['data'];
353
+            // Start validation
354
+            $data = $param['data'];
355 355
 			
356
-			// Checking type input
357
-			switch ($param['type']) {
356
+            // Checking type input
357
+            switch ($param['type']) {
358 358
 				
359
-				case 'input':
360
-					$success += $this->validateInput($param['data']);
361
-					break;
362
-				case 'radio':
363
-					$success += $this->validateRadio($param);
364
-					break;
365
-				case 'select':
366
-					$success += $this->validateSelect($param);
367
-					break;
368
-				default:
369
-					$success++;
370
-			}
371
-		}
372
-		
373
-		if ($success >= $total) return true;
374
-		return false;
375
-	}
376
-	
377
-	/**
378
-	 * @name validateInput
379
-	 * @tutorial This function test if an input (text, password, checkbox, ...) is valid depending assigned values
380
-	 * If you need other that is not invented, you can use "pattern" for example
381
-	 * It checks:
382
-	 * 	- required
383
-	 *  - date
384
-	 *  - min
385
-	 *  - max
386
-	 *  - number
387
-	 * @param array $data Contains all information about input
388
-	 * @return boolean If return true, its okay
389
-	 */
390
-	private function validateInput($data) {
391
-		// Obtaining value send by user
392
-		$readValue = $this->getData($data['name']);
359
+                case 'input':
360
+                    $success += $this->validateInput($param['data']);
361
+                    break;
362
+                case 'radio':
363
+                    $success += $this->validateRadio($param);
364
+                    break;
365
+                case 'select':
366
+                    $success += $this->validateSelect($param);
367
+                    break;
368
+                default:
369
+                    $success++;
370
+            }
371
+        }
372
+		
373
+        if ($success >= $total) return true;
374
+        return false;
375
+    }
376
+	
377
+    /**
378
+     * @name validateInput
379
+     * @tutorial This function test if an input (text, password, checkbox, ...) is valid depending assigned values
380
+     * If you need other that is not invented, you can use "pattern" for example
381
+     * It checks:
382
+     * 	- required
383
+     *  - date
384
+     *  - min
385
+     *  - max
386
+     *  - number
387
+     * @param array $data Contains all information about input
388
+     * @return boolean If return true, its okay
389
+     */
390
+    private function validateInput($data) {
391
+        // Obtaining value send by user
392
+        $readValue = $this->getData($data['name']);
393 393
 
394
-		// Empty/not send and required?
395
-		// TODO: Add require --> file (uses $_FILE)
396
-		
397
-		if (isset($data['required']) and ($readValue === null or $readValue == '')) {
398
-			$this->log('is required', $data);
399
-			return false;
400
-		} elseif ($readValue == '') {
401
-			return true;
402
-		}
403
-		
404
-		// Checking type input
405
-		switch ($data['type']) {
406
-			case 'text':
407
-				// Maxlenght fail
408
-				if (isset($data['maxlength']) and is_numeric($data['maxlength']) and $data['maxlength'] > -1 
409
-					and strlen($readValue) > $data['maxlength']) {
394
+        // Empty/not send and required?
395
+        // TODO: Add require --> file (uses $_FILE)
396
+		
397
+        if (isset($data['required']) and ($readValue === null or $readValue == '')) {
398
+            $this->log('is required', $data);
399
+            return false;
400
+        } elseif ($readValue == '') {
401
+            return true;
402
+        }
403
+		
404
+        // Checking type input
405
+        switch ($data['type']) {
406
+            case 'text':
407
+                // Maxlenght fail
408
+                if (isset($data['maxlength']) and is_numeric($data['maxlength']) and $data['maxlength'] > -1 
409
+                    and strlen($readValue) > $data['maxlength']) {
410 410
 					
411
-					$this->log('is too long. Maximum' . ' ' . $data['maxlength'] . ' ' . 'characters', $data );
412
-					return false;
413
-				}
411
+                    $this->log('is too long. Maximum' . ' ' . $data['maxlength'] . ' ' . 'characters', $data );
412
+                    return false;
413
+                }
414 414
 				
415
-				if (isset($data['pattern']) and is_numeric($data['pattern']) and $data['maxlength'] != '' 
416
-					and preg_match($data['pattern'], $readValue) === FALSE) {
415
+                if (isset($data['pattern']) and is_numeric($data['pattern']) and $data['maxlength'] != '' 
416
+                    and preg_match($data['pattern'], $readValue) === FALSE) {
417 417
 					
418
-					$this->log('pattern error' . ' (' . $data['pattern'] . ')' , $data);
419
-					return false;
420
-				}
421
-				break;
422
-			case 'number':
423
-			case 'range':
424
-				// IS NUMERIC
425
-				if ($readValue != '' and !is_numeric($readValue)) {
426
-					$this->log('Not numeric', $data);
427
-					return false;
428
-				}
418
+                    $this->log('pattern error' . ' (' . $data['pattern'] . ')' , $data);
419
+                    return false;
420
+                }
421
+                break;
422
+            case 'number':
423
+            case 'range':
424
+                // IS NUMERIC
425
+                if ($readValue != '' and !is_numeric($readValue)) {
426
+                    $this->log('Not numeric', $data);
427
+                    return false;
428
+                }
429 429
 				
430
-				// MIN
431
-				if (isset($data['min']) and $readValue < $data['min']) {
432
-					$this->log('The number have to be greather than' . ' ' . $data['min'].'.', $data);
433
-					return false;
434
-				}
430
+                // MIN
431
+                if (isset($data['min']) and $readValue < $data['min']) {
432
+                    $this->log('The number have to be greather than' . ' ' . $data['min'].'.', $data);
433
+                    return false;
434
+                }
435 435
 				
436
-				// MAX
437
-				if (isset($data['max']) and $readValue > $data['max']) {
438
-					$this->log('The number have to be less than' . ' ' . $data['max'].'.', $data);
439
-					return false;
440
-				}
436
+                // MAX
437
+                if (isset($data['max']) and $readValue > $data['max']) {
438
+                    $this->log('The number have to be less than' . ' ' . $data['max'].'.', $data);
439
+                    return false;
440
+                }
441 441
 				
442
-				// STEP http://www.w3schools.com/tags/att_input_step.asp
443
-				// Value 0 ever is valid (and if you try Divide to Zero, it will take error because the result is inifinite
444
-				if (isset($data['step']) and $readValue != 0 and $readValue % $data['step'] !== 0) {
445
-					$this->log('The number have to be multiple of' . ' ' . $data['step'].'.', $data);
446
-					return false;
447
-				}
442
+                // STEP http://www.w3schools.com/tags/att_input_step.asp
443
+                // Value 0 ever is valid (and if you try Divide to Zero, it will take error because the result is inifinite
444
+                if (isset($data['step']) and $readValue != 0 and $readValue % $data['step'] !== 0) {
445
+                    $this->log('The number have to be multiple of' . ' ' . $data['step'].'.', $data);
446
+                    return false;
447
+                }
448 448
 				
449
-				break;
450
-			case 'date';
451
-				//min | max
452
-				echo $readValue;
453
-				if (!is_date($readValue)) {
454
-					$this->log('The date' . ' ' .$readValue.' '. 'must have format' . ' mm/dd/yyyy '.'.', $data);
455
-					return false;
456
-				}
457
-				break;
449
+                break;
450
+            case 'date';
451
+                //min | max
452
+                echo $readValue;
453
+                if (!is_date($readValue)) {
454
+                    $this->log('The date' . ' ' .$readValue.' '. 'must have format' . ' mm/dd/yyyy '.'.', $data);
455
+                    return false;
456
+                }
457
+                break;
458 458
 				
459
-			case 'email':
460
-				if (!filter_var($readValue, FILTER_VALIDATE_EMAIL)) {
461
-					$this->log('Email invalid', $data);
462
-					return false;
463
-				}
464
-			case 'file':
465
-				//accept="image/*" (http://www.w3schools.com/tags/att_input_accept.asp)
466
-				break;
459
+            case 'email':
460
+                if (!filter_var($readValue, FILTER_VALIDATE_EMAIL)) {
461
+                    $this->log('Email invalid', $data);
462
+                    return false;
463
+                }
464
+            case 'file':
465
+                //accept="image/*" (http://www.w3schools.com/tags/att_input_accept.asp)
466
+                break;
467 467
 			
468
-			case 'url':
469
-				if (!filter_var($readValue, FILTER_VALIDATE_URL)) {
470
-					$this->log('Invalid url', $data);
471
-					return false;
472
-				}
473
-				break;	
474
-		}
475
-		// Validamos el resto como cierto (no podemos parametrizar el 100 % de cosas nuevas que salgan de HTML)
476
-		return true;
477
-	}
478
-	
479
-	/**
480
-	 * @name validateArray
481
-	 * This functions validate an Array, is a complement to validateRadio, select...
482
-	 * @param array/string $values List of values to validate
483
-	 * @param array/string $value/s selecteds by user 
484
-	 */
485
-	private function validateArray($values, $value, $data = array()) {
486
-		if (is_array($values)) {
487
-			// Is array (serach all "$value" in "$values"
488
-			if (!array_key_exists($value, $values)) {
489
-				if (is_array($value)) {
490
-					$this->log('Values don\'t match.', $data);
491
-				} else {
492
-					$this->log('ID ' .$value.' ' . 'don\'t match', $data);
493
-				}
494
-				return false;
495
-			}
496
-		} else {
497
-			// Is string
498
-			if ($readValue == $values) {
499
-				$this->log('The value' . ' ' . $value.' ' . 'is not available', $data);
500
-				return false;
501
-			}
502
-		}
503
-		
504
-		return true;
505
-	}
506
-	
507
-	
508
-	/**
509
-	 * @name validateRadio
510
-	 * @tutorial This function test if an radio is valid depending assigned values
511
-	 * @param array $data Contains all information about input
512
-	 * @return boolean If return true, its okay
513
-	 */
514
-	private function validateRadio($params) {
515
-		$data = $params['data'];
516
-		// Obtaining value send by user
517
-		$readValue = $this->getData($data['name']);
518
-		
519
-		// Is required?
520
-		if (isset($data['required']) and ($readValue === null or $readValue == '')) {
521
-			$this->log('is required', $data);
522
-			return false;
523
-		} elseif ($readValue == '') {
524
-			return true;
525
-		}
526
-		
527
-		
528
-		// Seleccionamos que tipo de analisis (dependiendo si se ha creado como input o como radio)
529
-		// Esto no deberia estar aqui porque no es necesario, pero esta hecho por posibles despistes de usuarios finales
530
-		if (isset($params['values'])) {
531
-			return $this->validateArray($params['values'], $readValue, $data);
532
-		} elseif ($data['value']) {
533
-			// If user try to add radio like normal input... (into 'value' in index data)
534
-			return $this->validateArray($params['value'], $readValue, $data);
535
-		}
536
-		
537
-		return false;
538
-	}
539
-	
540
-	/**
541
-	 * @name validateSelect
542
-	 * @tutorial This function test if an select is valid depending assigned values
543
-	 * @param array $data Contains all information about input
544
-	 * @return boolean If return true, its okay
545
-	 */
546
-	private function validateSelect($param) {
547
-		$data = $param['data'];
548
-		// Obtaining value send by user
549
-		$readValue = $this->getData($data['name']);
550
-	
551
-		// Is required?
552
-		if (isset($data['required']) and ($readValue === null or $readValue == '')) {
553
-			$this->log('is required', $data);
554
-			return false;
555
-		} elseif ($readValue == '') {
556
-			return true;
557
-		}
558
-	
559
-		// Seleccionamos que tipo de analisis (dependiendo si se ha creado como input o como radio)
560
-		// Esto no deberia estar aqui porque no es necesario, pero esta hecho por posibles despistes de usuarios finales
561
-		return $this->validateArray($param['values'], $readValue, $data);
562
-	}
563
-	
564
-	
565
-	/**
566
-	 * @name getData This function get value from POST/GET trhough ID ($key)
567
-	 * 	If you use other system to load GET and POST, you have to edit this
568
-	 * @param string $key Object Index
569
-	 * @param string $default Default item if not data
570
-	 * @return string/null Return the value, if don't exist, return null
571
-	 */
572
-	private function getData($key, $default = null) {
573
-		if ($this->method == "post") return isset($_POST[$key]) ? $_POST[$key] : $default;
574
-		else return isset($_GET[$key]) ? $_GET[$key] : $default;
575
-	}
576
-	
577
-	/*
468
+            case 'url':
469
+                if (!filter_var($readValue, FILTER_VALIDATE_URL)) {
470
+                    $this->log('Invalid url', $data);
471
+                    return false;
472
+                }
473
+                break;	
474
+        }
475
+        // Validamos el resto como cierto (no podemos parametrizar el 100 % de cosas nuevas que salgan de HTML)
476
+        return true;
477
+    }
478
+	
479
+    /**
480
+     * @name validateArray
481
+     * This functions validate an Array, is a complement to validateRadio, select...
482
+     * @param array/string $values List of values to validate
483
+     * @param array/string $value/s selecteds by user 
484
+     */
485
+    private function validateArray($values, $value, $data = array()) {
486
+        if (is_array($values)) {
487
+            // Is array (serach all "$value" in "$values"
488
+            if (!array_key_exists($value, $values)) {
489
+                if (is_array($value)) {
490
+                    $this->log('Values don\'t match.', $data);
491
+                } else {
492
+                    $this->log('ID ' .$value.' ' . 'don\'t match', $data);
493
+                }
494
+                return false;
495
+            }
496
+        } else {
497
+            // Is string
498
+            if ($readValue == $values) {
499
+                $this->log('The value' . ' ' . $value.' ' . 'is not available', $data);
500
+                return false;
501
+            }
502
+        }
503
+		
504
+        return true;
505
+    }
506
+	
507
+	
508
+    /**
509
+     * @name validateRadio
510
+     * @tutorial This function test if an radio is valid depending assigned values
511
+     * @param array $data Contains all information about input
512
+     * @return boolean If return true, its okay
513
+     */
514
+    private function validateRadio($params) {
515
+        $data = $params['data'];
516
+        // Obtaining value send by user
517
+        $readValue = $this->getData($data['name']);
518
+		
519
+        // Is required?
520
+        if (isset($data['required']) and ($readValue === null or $readValue == '')) {
521
+            $this->log('is required', $data);
522
+            return false;
523
+        } elseif ($readValue == '') {
524
+            return true;
525
+        }
526
+		
527
+		
528
+        // Seleccionamos que tipo de analisis (dependiendo si se ha creado como input o como radio)
529
+        // Esto no deberia estar aqui porque no es necesario, pero esta hecho por posibles despistes de usuarios finales
530
+        if (isset($params['values'])) {
531
+            return $this->validateArray($params['values'], $readValue, $data);
532
+        } elseif ($data['value']) {
533
+            // If user try to add radio like normal input... (into 'value' in index data)
534
+            return $this->validateArray($params['value'], $readValue, $data);
535
+        }
536
+		
537
+        return false;
538
+    }
539
+	
540
+    /**
541
+     * @name validateSelect
542
+     * @tutorial This function test if an select is valid depending assigned values
543
+     * @param array $data Contains all information about input
544
+     * @return boolean If return true, its okay
545
+     */
546
+    private function validateSelect($param) {
547
+        $data = $param['data'];
548
+        // Obtaining value send by user
549
+        $readValue = $this->getData($data['name']);
550
+	
551
+        // Is required?
552
+        if (isset($data['required']) and ($readValue === null or $readValue == '')) {
553
+            $this->log('is required', $data);
554
+            return false;
555
+        } elseif ($readValue == '') {
556
+            return true;
557
+        }
558
+	
559
+        // Seleccionamos que tipo de analisis (dependiendo si se ha creado como input o como radio)
560
+        // Esto no deberia estar aqui porque no es necesario, pero esta hecho por posibles despistes de usuarios finales
561
+        return $this->validateArray($param['values'], $readValue, $data);
562
+    }
563
+	
564
+	
565
+    /**
566
+     * @name getData This function get value from POST/GET trhough ID ($key)
567
+     * 	If you use other system to load GET and POST, you have to edit this
568
+     * @param string $key Object Index
569
+     * @param string $default Default item if not data
570
+     * @return string/null Return the value, if don't exist, return null
571
+     */
572
+    private function getData($key, $default = null) {
573
+        if ($this->method == "post") return isset($_POST[$key]) ? $_POST[$key] : $default;
574
+        else return isset($_GET[$key]) ? $_GET[$key] : $default;
575
+    }
576
+	
577
+    /*
578 578
 	 * Array constructors
579 579
 	 * This functions will be called to self construct array easy
580 580
 	 */
581 581
 	
582
-	/**
583
-	 * @name separator
584
-	 * @tutorial This function add separation (<hr/>) between parts
585
-	 */
586
-	public function addSeparator() {
587
-		$this->content[] = array('type' => 'separator');
588
-	}
589
-	
590
-	/**
591
-	 * @name addInput
592
-	 * @tutorial This class generate a generic INPUT
593
-	 * @param string $label If is not empty, it show a text "label" with the text
594
-	 * @param string $type Specify input type. It will be validated once use validate();
595
-	 * Types that are current supported to validate:
596
-	 * 		text, password, hidden, file
597
-	 * 		Its supported use ALL type supported (http://www.w3schools.com/tags/att_input_type.asp), 
598
-	 * 	Some type input you can declare directly via functions (afther this function are more)
599
-	 * @param string $name Element name
600
-	 * @param string $value Element value
601
-	 * @param string $required Element required?
602
-	 * @param array $attributes Optional atributes not listened (in array).
603
-	 * 		EX: You like use "date", then you can put array('min' => '1979-12-31', 'max' => '2000-01-02')
604
-	 * 		All parameters currently working: min, max (date and number), pattern,   
605
-	 * 
606
-	 * @example $fr->addInput('text', 'Username', '', true, 'Type here your username', array('class'=>'text red', id => 'text1'), array())
607
-	 */
608
-	public function addInput($label = '', $type = 'text', $name = '', $value = '', $required = false, $placeholder = '',  $attributes = array()) {
609
-		// Creating main data
610
-		$data = array(
611
-			'type' => $type,
612
-			'name' => $name,
613
-			'value' => $value,
614
-		);
615
-		
616
-		
617
-		if ($required) $data['required'] = 'required';
618
-		if ($placeholder != '') $data['placeholder'] = $placeholder;
619
-		if (!empty($attributes)) array_merge($data, $attributes);
620
-		
621
-		
622
-		// Saving data to object
623
-		$content = array(
624
-			'type' => 'input',
625
-			'data' => $data	
626
-		);
627
-		if ($label != '') $content['label'] = $label;
582
+    /**
583
+     * @name separator
584
+     * @tutorial This function add separation (<hr/>) between parts
585
+     */
586
+    public function addSeparator() {
587
+        $this->content[] = array('type' => 'separator');
588
+    }
589
+	
590
+    /**
591
+     * @name addInput
592
+     * @tutorial This class generate a generic INPUT
593
+     * @param string $label If is not empty, it show a text "label" with the text
594
+     * @param string $type Specify input type. It will be validated once use validate();
595
+     * Types that are current supported to validate:
596
+     * 		text, password, hidden, file
597
+     * 		Its supported use ALL type supported (http://www.w3schools.com/tags/att_input_type.asp), 
598
+     * 	Some type input you can declare directly via functions (afther this function are more)
599
+     * @param string $name Element name
600
+     * @param string $value Element value
601
+     * @param string $required Element required?
602
+     * @param array $attributes Optional atributes not listened (in array).
603
+     * 		EX: You like use "date", then you can put array('min' => '1979-12-31', 'max' => '2000-01-02')
604
+     * 		All parameters currently working: min, max (date and number), pattern,   
605
+     * 
606
+     * @example $fr->addInput('text', 'Username', '', true, 'Type here your username', array('class'=>'text red', id => 'text1'), array())
607
+     */
608
+    public function addInput($label = '', $type = 'text', $name = '', $value = '', $required = false, $placeholder = '',  $attributes = array()) {
609
+        // Creating main data
610
+        $data = array(
611
+            'type' => $type,
612
+            'name' => $name,
613
+            'value' => $value,
614
+        );
615
+		
616
+		
617
+        if ($required) $data['required'] = 'required';
618
+        if ($placeholder != '') $data['placeholder'] = $placeholder;
619
+        if (!empty($attributes)) array_merge($data, $attributes);
620
+		
621
+		
622
+        // Saving data to object
623
+        $content = array(
624
+            'type' => 'input',
625
+            'data' => $data	
626
+        );
627
+        if ($label != '') $content['label'] = $label;
628 628
 		 
629
-		$this->content[] = $content;
630
-	}
631
-	
632
-	/**
633
-	 * @name addNumber This function add input "number" and "date" with min, max and step (if you like)
634
-	 * @param string $label If is not empty, it show a text "label" with the text
635
-	 * @param string $name Element name
636
-	 * @param string $value Default value
637
-	 * @param boolen $range If is true, then show "range" instead of text with number
638
-	 * @param boolen $required Is required?
639
-	 * @param number $min Minium value. Empty nothing
640
-	 * @param number $max Max value. Empty nothing
641
-	 * @param number $step Step (multiply). Empty nothing (ex: step 2: -2, 0, 2, 4 ...)
642
-	 * @param string $placeholder Default text to show if box is empty
643
-	 * @param unknown $attributes Additional attributes
644
-	 */
645
-	public function addNumber($label = '', $name = '', $value = '', $range = false, $required = false, $min = '', $max = '', $step = '',  $placeholder = '',  $attributes = array()) {
646
-		// Creating main data
647
-		$data = array(
648
-			'type' => (! $range) ? 'number' : 'range',
649
-			'name' => $name,
650
-			'value' => $value,
651
-		);
652
-	
653
-		
654
-		if ($required) $data['required'] = 'required';
655
-		if ($min) $data['min'] = $min;
656
-		if ($max) $data['max'] = $max;
657
-		if ($step) $data['step'] = $step;
658
-		if ($placeholder != '') $data['placeholder'] = $placeholder;
659
-		if (!empty($attributes)) array_merge($data, $attributes);
660
-	
661
-		// Saving data to object
662
-		$content = array(
663
-			'type' => 'input',
664
-			'data' => $data
665
-		);
666
-		if ($label != '') $content['label'] = $label;
667
-		
668
-		$this->content[] = $content;
669
-	}
629
+        $this->content[] = $content;
630
+    }
631
+	
632
+    /**
633
+     * @name addNumber This function add input "number" and "date" with min, max and step (if you like)
634
+     * @param string $label If is not empty, it show a text "label" with the text
635
+     * @param string $name Element name
636
+     * @param string $value Default value
637
+     * @param boolen $range If is true, then show "range" instead of text with number
638
+     * @param boolen $required Is required?
639
+     * @param number $min Minium value. Empty nothing
640
+     * @param number $max Max value. Empty nothing
641
+     * @param number $step Step (multiply). Empty nothing (ex: step 2: -2, 0, 2, 4 ...)
642
+     * @param string $placeholder Default text to show if box is empty
643
+     * @param unknown $attributes Additional attributes
644
+     */
645
+    public function addNumber($label = '', $name = '', $value = '', $range = false, $required = false, $min = '', $max = '', $step = '',  $placeholder = '',  $attributes = array()) {
646
+        // Creating main data
647
+        $data = array(
648
+            'type' => (! $range) ? 'number' : 'range',
649
+            'name' => $name,
650
+            'value' => $value,
651
+        );
652
+	
653
+		
654
+        if ($required) $data['required'] = 'required';
655
+        if ($min) $data['min'] = $min;
656
+        if ($max) $data['max'] = $max;
657
+        if ($step) $data['step'] = $step;
658
+        if ($placeholder != '') $data['placeholder'] = $placeholder;
659
+        if (!empty($attributes)) array_merge($data, $attributes);
660
+	
661
+        // Saving data to object
662
+        $content = array(
663
+            'type' => 'input',
664
+            'data' => $data
665
+        );
666
+        if ($label != '') $content['label'] = $label;
667
+		
668
+        $this->content[] = $content;
669
+    }
670 670
 
671
-	/**
672
-	 * @name addDate This function add input "number" with min, max and step (if you like)
673
-	 * @param string $label If is not empty, it show a text "label" with the text
674
-	 * @param string $name Element name
675
-	 * @param string $value Default value
676
-	 * @param string $required Is required?
677
-	 * @param string $min Minium value. Empty nothing
678
-	 * @param string $max Max value. Empty nothing
679
-	 * @param string $step Step (multiply). Empty nothing (ex: step 2: -2, 0, 2, 4 ...)
680
-	 * @param string $placeholder Default text to show if box is empty
681
-	 * @param unknown $attributes Additional attributes
682
-	 */
683
-	public function addDate($label = '', $name = '', $value = '', $required = false, $min = '', $max = '', $step = '',  $placeholder = '',  $attributes = array()) {
684
-		// Creating main data
685
-		$data = array(
686
-			'type' => 'date',
687
-			'name' => $name,
688
-			'value' => $value,
689
-		);
690
-	
691
-		if ($required) $data['required'] = 'required';
692
-		if ($min) $data['min'] = $min;
693
-		if ($max) $data['max'] = $max;
694
-		if ($step) $data['step'] = $step;
695
-		if ($placeholder != '') $data['placeholder'] = $placeholder;
696
-		if (!empty($attributes)) array_merge($data, $attributes);
697
-	
698
-		// Saving data to object
699
-		$content = array(
700
-			'type' => 'input',
701
-			'data' => $data
702
-		);
703
-		if ($label != '') $content['label'] = $label;
704
-		
705
-		$this->content[] = $content;
706
-	}
707
-	
708
-	
709
-	/**
710
-	 * @name addCheck
711
-	 * @tutorial Use this function to add a checkBox
712
-	 * @param string $label If is not empty, it show a text "label" with the text
713
-	 * @param string $name Check name
714
-	 * @param string $value Check value
715
-	 * @param boolean $required Specify if check is required
716
-	 * @param array $attributes Optional atributes not listened (in array).
717
-	 */
718
-	public function addCheck($label = '', $name = '', $value = '', $required = false, $attributes = array()) {
719
-		$data = array(
720
-			'type' => 'checkbox',
721
-			'name' => $name,
722
-			'value' => $value
723
-		);
724
-		if ($required) $data['required'] = 'required';
725
-		if (!empty($attributes)) array_merge($data, $attributes);
726
-		
727
-		$content = array(
728
-			'type' => 'input',
729
-			'data' => $data 
730
-		);
731
-		if ($label != '') $content['label'] = $label;
732
-		
733
-		$this->content[] = $content;
734
-	}
735
-	
736
-	
737
-	/**
738
-	 * @name addRadio
739
-	 * @tutorial Use this function to add a radio button
740
-	 * @param string $label If is not empty, it show a text "label" with the text
741
-	 * @param string $name Radio button name
742
-	 * @param array $values Contain all radio with values and text to show 
743
-	 * 	EX: array('val1'=>'text1', 'val2'=>'text2'); 
744
-	 * @param string $selected Specify wich option (ID) will be checked by default 
745
-	 * @param boolean $required Specify if radio is required
746
-	 * @param array $attributes Optional atributes not listened (in array). This will be applicated to all radioButton
747
-	 */
748
-	public function addRadio($label = '', $name = '', $values = array(), $selected = null, $required = false, $attributes = array()) {
749
-		if (!is_array($values)) die('FATAL ERROR: Trying to create "RadioButton" with string VALUE, is requried use ARRAY()');
750
-		$data = array(
751
-			'name' => $name,
752
-		);
753
-		
754
-		if ($required) $data['required'] = 'required';		
755
-		if (!empty($attributes)) array_merge($data, $attributes);
756
-		
757
-		
758
-		
759
-		$content = array(
760
-			'type' => 'radio',
761
-			'data' => $data,
762
-			'values' => $values,
763
-			'selected' => $selected
764
-		);
765
-		if ($label != '') $content['label'] = $label;
766
-		
767
-		$this->content[] = $content;
768
-	}
769
-	
770
-	
771
-	/**
772
-	 * @name addSelect
773
-	 * @tutorial Use this function to add a radio button
774
-	 * @param string $label Text to show before input
775
-	 * @param string $name Select name
776
-	 * @param array $values Array('value'=>'text to show')
777
-	 * @param boolean $required Specify if select is required
778
-	 * @param string $id ID Specify ID to manipulate via javascript or CSS
779
-	 * @param array $attributes Optional atributes not listened (in array).
780
-	 */
781
-	public function addSelect($label = '', $name = '', $values = '', $selected = null, $required = false, $multiple = false, $attributes = array()) {
782
-		$data = array(
783
-			'name' => $name,
784
-			'required' => $required,
785
-		);
786
-		if ($required) $data['required'] = 'required';
787
-		if ($multiple) $data['multiple'] = 'multiple';
788
-		if (!empty($attributes)) array_merge($data, $attributes);
789
-		
790
-		
791
-		// In this case, the values are saved in the main of array to speed up select loader
792
-		$content = array(
793
-			'type' => 'select',
794
-			'data' => $data,
795
-			'values' => $values,
796
-			'selected' => $selected
797
-		);
798
-		if ($label != '') $content['label'] = $label;
799
-		
800
-		$this->content[] = $content;
801
-	}
802
-	
803
-	/**
804
-	 * @name addSubmit
805
-	 * @tutorial Use this function to add a submit button
806
-	 * @param string $name Select name (optional, if leav blank it will not send in POST / GET)
807
-	 * @param string $value Text to show in button and ID
808
-	 * @param array $attributes Optional atributes not listened (in array).
809
-	 */
810
-	public function addSubmit($name = '', $value = '', $attributes = array()) {
811
-		$data = array(
812
-			'type' => 'submit',
813
-			'name' => $name,
814
-			'value' => $value
815
-		);
816
-		if (!empty($attributes)) array_merge($data, $attributes);
817
-		
818
-		$this->content[] = array(
819
-			'type' => 'input',
820
-			'data' => $data
821
-		);
822
-		
823
-		
824
-	}
825
-	
826
-	/**
827
-	 * @name addButton
828
-	 * @tutorial Use this function to add a button with "onclick" action (or id/class to call via jquery) 
829
-	 * @param string $value Name to show in button and ID
830
-	 * @param string $onClick Action to load when button is clicked 
831
-	 * @param array $attributes Optional atributes not listened (in array).
832
-	 */
833
-	public function addButton($value = '', $onClick = '', $attributes = array()) {
834
-		$data = array(
835
-			'type' => 'button',
836
-			'value' => $value,
837
-			'onClick' => $onClick
838
-		);
839
-		if (!empty($attributes)) array_merge($data, $attributes);
840
-		
841
-		$this->content[] = array(
842
-			'type' => 'input',
843
-			'data' => $data
844
-		);
845
-	}
846
-	
847
-	
848
-	/**
849
-	 * @name addButton
850
-	 * @tutorial Use this function to add a button with "onclick" action (or id/class to call via jquery)
851
-	 * @param string $value Name to show in button and ID
852
-	 * @param string $onClick Action to load when button is clicked
853
-	 * @param array $attributes Optional atributes not listened (in array).
854
-	 */
855
-	public function addTextArea($label = '', $name = '', $value = '', $required = false, $attributes = array()) {
856
-		// Creating main data
857
-		$data = array(
858
-			'name' => $name,
859
-		);
860
-		
861
-		if ($required) $data['required'] = 'required';
862
-		if (!empty($attributes)) array_merge($data, $attributes);
863
-		
864
-		// Saving data to object
865
-		$content = array(
866
-			'type' => 'textarea',
867
-			'text' => $value,
868
-			'data' => $data	
869
-		);
870
-		if ($label != '') $content['label'] = $label;
671
+    /**
672
+     * @name addDate This function add input "number" with min, max and step (if you like)
673
+     * @param string $label If is not empty, it show a text "label" with the text
674
+     * @param string $name Element name
675
+     * @param string $value Default value
676
+     * @param string $required Is required?
677
+     * @param string $min Minium value. Empty nothing
678
+     * @param string $max Max value. Empty nothing
679
+     * @param string $step Step (multiply). Empty nothing (ex: step 2: -2, 0, 2, 4 ...)
680
+     * @param string $placeholder Default text to show if box is empty
681
+     * @param unknown $attributes Additional attributes
682
+     */
683
+    public function addDate($label = '', $name = '', $value = '', $required = false, $min = '', $max = '', $step = '',  $placeholder = '',  $attributes = array()) {
684
+        // Creating main data
685
+        $data = array(
686
+            'type' => 'date',
687
+            'name' => $name,
688
+            'value' => $value,
689
+        );
690
+	
691
+        if ($required) $data['required'] = 'required';
692
+        if ($min) $data['min'] = $min;
693
+        if ($max) $data['max'] = $max;
694
+        if ($step) $data['step'] = $step;
695
+        if ($placeholder != '') $data['placeholder'] = $placeholder;
696
+        if (!empty($attributes)) array_merge($data, $attributes);
697
+	
698
+        // Saving data to object
699
+        $content = array(
700
+            'type' => 'input',
701
+            'data' => $data
702
+        );
703
+        if ($label != '') $content['label'] = $label;
704
+		
705
+        $this->content[] = $content;
706
+    }
707
+	
708
+	
709
+    /**
710
+     * @name addCheck
711
+     * @tutorial Use this function to add a checkBox
712
+     * @param string $label If is not empty, it show a text "label" with the text
713
+     * @param string $name Check name
714
+     * @param string $value Check value
715
+     * @param boolean $required Specify if check is required
716
+     * @param array $attributes Optional atributes not listened (in array).
717
+     */
718
+    public function addCheck($label = '', $name = '', $value = '', $required = false, $attributes = array()) {
719
+        $data = array(
720
+            'type' => 'checkbox',
721
+            'name' => $name,
722
+            'value' => $value
723
+        );
724
+        if ($required) $data['required'] = 'required';
725
+        if (!empty($attributes)) array_merge($data, $attributes);
726
+		
727
+        $content = array(
728
+            'type' => 'input',
729
+            'data' => $data 
730
+        );
731
+        if ($label != '') $content['label'] = $label;
732
+		
733
+        $this->content[] = $content;
734
+    }
735
+	
736
+	
737
+    /**
738
+     * @name addRadio
739
+     * @tutorial Use this function to add a radio button
740
+     * @param string $label If is not empty, it show a text "label" with the text
741
+     * @param string $name Radio button name
742
+     * @param array $values Contain all radio with values and text to show 
743
+     * 	EX: array('val1'=>'text1', 'val2'=>'text2'); 
744
+     * @param string $selected Specify wich option (ID) will be checked by default 
745
+     * @param boolean $required Specify if radio is required
746
+     * @param array $attributes Optional atributes not listened (in array). This will be applicated to all radioButton
747
+     */
748
+    public function addRadio($label = '', $name = '', $values = array(), $selected = null, $required = false, $attributes = array()) {
749
+        if (!is_array($values)) die('FATAL ERROR: Trying to create "RadioButton" with string VALUE, is requried use ARRAY()');
750
+        $data = array(
751
+            'name' => $name,
752
+        );
753
+		
754
+        if ($required) $data['required'] = 'required';		
755
+        if (!empty($attributes)) array_merge($data, $attributes);
756
+		
757
+		
758
+		
759
+        $content = array(
760
+            'type' => 'radio',
761
+            'data' => $data,
762
+            'values' => $values,
763
+            'selected' => $selected
764
+        );
765
+        if ($label != '') $content['label'] = $label;
766
+		
767
+        $this->content[] = $content;
768
+    }
769
+	
770
+	
771
+    /**
772
+     * @name addSelect
773
+     * @tutorial Use this function to add a radio button
774
+     * @param string $label Text to show before input
775
+     * @param string $name Select name
776
+     * @param array $values Array('value'=>'text to show')
777
+     * @param boolean $required Specify if select is required
778
+     * @param string $id ID Specify ID to manipulate via javascript or CSS
779
+     * @param array $attributes Optional atributes not listened (in array).
780
+     */
781
+    public function addSelect($label = '', $name = '', $values = '', $selected = null, $required = false, $multiple = false, $attributes = array()) {
782
+        $data = array(
783
+            'name' => $name,
784
+            'required' => $required,
785
+        );
786
+        if ($required) $data['required'] = 'required';
787
+        if ($multiple) $data['multiple'] = 'multiple';
788
+        if (!empty($attributes)) array_merge($data, $attributes);
789
+		
790
+		
791
+        // In this case, the values are saved in the main of array to speed up select loader
792
+        $content = array(
793
+            'type' => 'select',
794
+            'data' => $data,
795
+            'values' => $values,
796
+            'selected' => $selected
797
+        );
798
+        if ($label != '') $content['label'] = $label;
799
+		
800
+        $this->content[] = $content;
801
+    }
802
+	
803
+    /**
804
+     * @name addSubmit
805
+     * @tutorial Use this function to add a submit button
806
+     * @param string $name Select name (optional, if leav blank it will not send in POST / GET)
807
+     * @param string $value Text to show in button and ID
808
+     * @param array $attributes Optional atributes not listened (in array).
809
+     */
810
+    public function addSubmit($name = '', $value = '', $attributes = array()) {
811
+        $data = array(
812
+            'type' => 'submit',
813
+            'name' => $name,
814
+            'value' => $value
815
+        );
816
+        if (!empty($attributes)) array_merge($data, $attributes);
817
+		
818
+        $this->content[] = array(
819
+            'type' => 'input',
820
+            'data' => $data
821
+        );
822
+		
823
+		
824
+    }
825
+	
826
+    /**
827
+     * @name addButton
828
+     * @tutorial Use this function to add a button with "onclick" action (or id/class to call via jquery) 
829
+     * @param string $value Name to show in button and ID
830
+     * @param string $onClick Action to load when button is clicked 
831
+     * @param array $attributes Optional atributes not listened (in array).
832
+     */
833
+    public function addButton($value = '', $onClick = '', $attributes = array()) {
834
+        $data = array(
835
+            'type' => 'button',
836
+            'value' => $value,
837
+            'onClick' => $onClick
838
+        );
839
+        if (!empty($attributes)) array_merge($data, $attributes);
840
+		
841
+        $this->content[] = array(
842
+            'type' => 'input',
843
+            'data' => $data
844
+        );
845
+    }
846
+	
847
+	
848
+    /**
849
+     * @name addButton
850
+     * @tutorial Use this function to add a button with "onclick" action (or id/class to call via jquery)
851
+     * @param string $value Name to show in button and ID
852
+     * @param string $onClick Action to load when button is clicked
853
+     * @param array $attributes Optional atributes not listened (in array).
854
+     */
855
+    public function addTextArea($label = '', $name = '', $value = '', $required = false, $attributes = array()) {
856
+        // Creating main data
857
+        $data = array(
858
+            'name' => $name,
859
+        );
860
+		
861
+        if ($required) $data['required'] = 'required';
862
+        if (!empty($attributes)) array_merge($data, $attributes);
863
+		
864
+        // Saving data to object
865
+        $content = array(
866
+            'type' => 'textarea',
867
+            'text' => $value,
868
+            'data' => $data	
869
+        );
870
+        if ($label != '') $content['label'] = $label;
871 871
 		 
872
-		$this->content[] = $content;
873
-	}
872
+        $this->content[] = $content;
873
+    }
874 874
 	
875
-	/*
875
+    /*
876 876
 	 * OTHER
877 877
 	 */
878
-	/**
879
-	 * @name log
880
-	 * @tutorial Save a log if is enabled logging
881
-	 * @param boolean $save If is true, save the log
882
-	 * @param string $message Message to log
883
-	 */
884
-	private function log($message, $data = array()) {
885
-		if ($this->logErrors) {
886
-			// Try to get a name (label or name)
887
-			if (class_exists('kw')) {
888
-				if (isset($data['label'])) $this->errors .= 'Found an error in field' . ': "' . $data['label'] . '": ';
889
-				elseif (isset($data['name'])) $this->errors .= 'Found an error in field' . ': "' . $data['name'] . '": ';
890
-			} else {
891
-				if (isset($data['label'])) $this->errors .= 'Found an error in field' . $data['label'] . '": ';
892
-				elseif (isset($data['name'])) $this->errors .= 'Found an error in field' . ': "' . $data['name'] . '": ';
893
-			}
878
+    /**
879
+     * @name log
880
+     * @tutorial Save a log if is enabled logging
881
+     * @param boolean $save If is true, save the log
882
+     * @param string $message Message to log
883
+     */
884
+    private function log($message, $data = array()) {
885
+        if ($this->logErrors) {
886
+            // Try to get a name (label or name)
887
+            if (class_exists('kw')) {
888
+                if (isset($data['label'])) $this->errors .= 'Found an error in field' . ': "' . $data['label'] . '": ';
889
+                elseif (isset($data['name'])) $this->errors .= 'Found an error in field' . ': "' . $data['name'] . '": ';
890
+            } else {
891
+                if (isset($data['label'])) $this->errors .= 'Found an error in field' . $data['label'] . '": ';
892
+                elseif (isset($data['name'])) $this->errors .= 'Found an error in field' . ': "' . $data['name'] . '": ';
893
+            }
894 894
 			
895
-			// preparing message
896
-			$this->errors .= ' ' . $message . '.';
895
+            // preparing message
896
+            $this->errors .= ' ' . $message . '.';
897 897
 			
898
-			// Extra message (title attribute)
899
-			if (isset($data['title']) and $data['title'] != '') $this->errors .= ' | '. 'MESSAGE' .': ' . $data['title'];
898
+            // Extra message (title attribute)
899
+            if (isset($data['title']) and $data['title'] != '') $this->errors .= ' | '. 'MESSAGE' .': ' . $data['title'];
900 900
 			
901
-			$this->errors .= '<br />';
902
-		}
903
-	}
901
+            $this->errors .= '<br />';
902
+        }
903
+    }
904 904
 }
905 905
 
906 906
 
@@ -914,23 +914,23 @@  discard block
 block discarded – undo
914 914
 // More examples:
915 915
 // http://us2.php.net/manual/es/function.checkdate.php
916 916
 function is_date( $str ) {
917
-	// Try to execute date creator
918
-	try {
919
-		$dt = new DateTime( trim($str) );
920
-	} catch( Exception $e ) {
921
-		// If fails, it return false, date is incorrect
922
-		return false;
923
-	}
924
-	
925
-	// Checking date
926
-	$month = $dt->format('m');
927
-	$day = $dt->format('d');
928
-	$year = $dt->format('Y');
929
-	
930
-	// Date is ok
931
-	if (checkdate($month, $day, $year)) {
932
-		return true;
933
-	} else {
934
-		return false;
935
-	}
917
+    // Try to execute date creator
918
+    try {
919
+        $dt = new DateTime( trim($str) );
920
+    } catch( Exception $e ) {
921
+        // If fails, it return false, date is incorrect
922
+        return false;
923
+    }
924
+	
925
+    // Checking date
926
+    $month = $dt->format('m');
927
+    $day = $dt->format('d');
928
+    $year = $dt->format('Y');
929
+	
930
+    // Date is ok
931
+    if (checkdate($month, $day, $year)) {
932
+        return true;
933
+    } else {
934
+        return false;
935
+    }
936 936
 }
937 937
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
 							break;
162 162
 					}
163 163
 				echo '</div>';
164
-			echo '</div>'.PHP_EOL;
164
+			echo '</div>' . PHP_EOL;
165 165
 		}
166 166
 		
167 167
 		// Closing form
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
 		
192 192
 		// Asignamos las claves conviritiendo el array
193 193
 		foreach ($data as $attr=>$value) {
194
-			$r .= $attr.'="'.$value.'" ';
194
+			$r .= $attr . '="' . $value . '" ';
195 195
 		}
196 196
 		
197 197
 		$r .= '/>';
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
 		
210 210
 		// Asignamos las claves conviritiendo el array
211 211
 		foreach ($data as $attr=>$value) {
212
-			$base .= $attr.'="'.$value.'" ';
212
+			$base .= $attr . '="' . $value . '" ';
213 213
 		}
214 214
 		
215 215
 		
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
 		if (!is_array($values)) {
222 222
 			// Comprobamos el value, es posible que el usuario este intentando crear los Radio (option) de forma separada
223 223
 			if (!is_array($values) and $selected == $values) $base .= ' checked="checked" ';
224
-			return $base . ' value="'.$values.'" />';
224
+			return $base . ' value="' . $values . '" />';
225 225
 		} 
226 226
 
227 227
 		// Por el contrario, tenemos 1 o m�s value con lo que es un posible texto
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
 		foreach ($values as $id=>$text) {
231 231
 			$r .= $base;
232 232
 			if ($selected !== null and $id == $selected) $r .= ' checked="checked" ';
233
-			$r .= ' value="'. $id .'" />'.$text.'</label>';
233
+			$r .= ' value="' . $id . '" />' . $text . '</label>';
234 234
 		}
235 235
 		
236 236
 		return $r;
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
 		$r = '<select ';
250 250
 			// Convert array to input string
251 251
 			foreach ($data as $attr=>$value) {
252
-				$r .= $attr.'="'.$value.'" ';
252
+				$r .= $attr . '="' . $value . '" ';
253 253
 			}
254 254
 			// Return end input
255 255
 		$r .= '>';
@@ -287,7 +287,7 @@  discard block
 block discarded – undo
287 287
 		
288 288
 		// Asignamos las claves conviritiendo el array
289 289
 		foreach ($data as $attr=>$value) {
290
-			$r .= $attr.'="'.$value.'" ';
290
+			$r .= $attr . '="' . $value . '" ';
291 291
 		}
292 292
 		
293 293
 		$r .= '>';
@@ -304,14 +304,14 @@  discard block
 block discarded – undo
304 304
 	 */
305 305
 	private function showStartForm() {
306 306
 		$r = '<form ';
307
-		if ($this->action!= '') $r .= 'action="'.$this->action.'" ';
308
-		if ($this->method != '') $r .= 'method="'.$this->method .'" ';
309
-		if ($this->name != '') $r .= 'name="'.$this->name .'" ';
310
-		if ($this->on_submit != '') $r .= 'onSubmit="'.$this->on_submit  .'" ';
311
-		if ($this->id != '') $r .= 'id="'.$this->id .'" ';
312
-		if ($this->class != '') $r .= 'class="'.$this->class .'" ';
313
-	
314
-		return $r . '>'.PHP_EOL;
307
+		if ($this->action != '') $r .= 'action="' . $this->action . '" ';
308
+		if ($this->method != '') $r .= 'method="' . $this->method . '" ';
309
+		if ($this->name != '') $r .= 'name="' . $this->name . '" ';
310
+		if ($this->on_submit != '') $r .= 'onSubmit="' . $this->on_submit . '" ';
311
+		if ($this->id != '') $r .= 'id="' . $this->id . '" ';
312
+		if ($this->class != '') $r .= 'class="' . $this->class . '" ';
313
+	
314
+		return $r . '>' . PHP_EOL;
315 315
 	}
316 316
 	
317 317
 	/**
@@ -408,14 +408,14 @@  discard block
 block discarded – undo
408 408
 				if (isset($data['maxlength']) and is_numeric($data['maxlength']) and $data['maxlength'] > -1 
409 409
 					and strlen($readValue) > $data['maxlength']) {
410 410
 					
411
-					$this->log('is too long. Maximum' . ' ' . $data['maxlength'] . ' ' . 'characters', $data );
411
+					$this->log('is too long. Maximum' . ' ' . $data['maxlength'] . ' ' . 'characters', $data);
412 412
 					return false;
413 413
 				}
414 414
 				
415 415
 				if (isset($data['pattern']) and is_numeric($data['pattern']) and $data['maxlength'] != '' 
416 416
 					and preg_match($data['pattern'], $readValue) === FALSE) {
417 417
 					
418
-					$this->log('pattern error' . ' (' . $data['pattern'] . ')' , $data);
418
+					$this->log('pattern error' . ' (' . $data['pattern'] . ')', $data);
419 419
 					return false;
420 420
 				}
421 421
 				break;
@@ -429,20 +429,20 @@  discard block
 block discarded – undo
429 429
 				
430 430
 				// MIN
431 431
 				if (isset($data['min']) and $readValue < $data['min']) {
432
-					$this->log('The number have to be greather than' . ' ' . $data['min'].'.', $data);
432
+					$this->log('The number have to be greather than' . ' ' . $data['min'] . '.', $data);
433 433
 					return false;
434 434
 				}
435 435
 				
436 436
 				// MAX
437 437
 				if (isset($data['max']) and $readValue > $data['max']) {
438
-					$this->log('The number have to be less than' . ' ' . $data['max'].'.', $data);
438
+					$this->log('The number have to be less than' . ' ' . $data['max'] . '.', $data);
439 439
 					return false;
440 440
 				}
441 441
 				
442 442
 				// STEP http://www.w3schools.com/tags/att_input_step.asp
443 443
 				// Value 0 ever is valid (and if you try Divide to Zero, it will take error because the result is inifinite
444 444
 				if (isset($data['step']) and $readValue != 0 and $readValue % $data['step'] !== 0) {
445
-					$this->log('The number have to be multiple of' . ' ' . $data['step'].'.', $data);
445
+					$this->log('The number have to be multiple of' . ' ' . $data['step'] . '.', $data);
446 446
 					return false;
447 447
 				}
448 448
 				
@@ -451,7 +451,7 @@  discard block
 block discarded – undo
451 451
 				//min | max
452 452
 				echo $readValue;
453 453
 				if (!is_date($readValue)) {
454
-					$this->log('The date' . ' ' .$readValue.' '. 'must have format' . ' mm/dd/yyyy '.'.', $data);
454
+					$this->log('The date' . ' ' . $readValue . ' ' . 'must have format' . ' mm/dd/yyyy ' . '.', $data);
455 455
 					return false;
456 456
 				}
457 457
 				break;
@@ -489,14 +489,14 @@  discard block
 block discarded – undo
489 489
 				if (is_array($value)) {
490 490
 					$this->log('Values don\'t match.', $data);
491 491
 				} else {
492
-					$this->log('ID ' .$value.' ' . 'don\'t match', $data);
492
+					$this->log('ID ' . $value . ' ' . 'don\'t match', $data);
493 493
 				}
494 494
 				return false;
495 495
 			}
496 496
 		} else {
497 497
 			// Is string
498 498
 			if ($readValue == $values) {
499
-				$this->log('The value' . ' ' . $value.' ' . 'is not available', $data);
499
+				$this->log('The value' . ' ' . $value . ' ' . 'is not available', $data);
500 500
 				return false;
501 501
 			}
502 502
 		}
@@ -605,7 +605,7 @@  discard block
 block discarded – undo
605 605
 	 * 
606 606
 	 * @example $fr->addInput('text', 'Username', '', true, 'Type here your username', array('class'=>'text red', id => 'text1'), array())
607 607
 	 */
608
-	public function addInput($label = '', $type = 'text', $name = '', $value = '', $required = false, $placeholder = '',  $attributes = array()) {
608
+	public function addInput($label = '', $type = 'text', $name = '', $value = '', $required = false, $placeholder = '', $attributes = array()) {
609 609
 		// Creating main data
610 610
 		$data = array(
611 611
 			'type' => $type,
@@ -642,10 +642,10 @@  discard block
 block discarded – undo
642 642
 	 * @param string $placeholder Default text to show if box is empty
643 643
 	 * @param unknown $attributes Additional attributes
644 644
 	 */
645
-	public function addNumber($label = '', $name = '', $value = '', $range = false, $required = false, $min = '', $max = '', $step = '',  $placeholder = '',  $attributes = array()) {
645
+	public function addNumber($label = '', $name = '', $value = '', $range = false, $required = false, $min = '', $max = '', $step = '', $placeholder = '', $attributes = array()) {
646 646
 		// Creating main data
647 647
 		$data = array(
648
-			'type' => (! $range) ? 'number' : 'range',
648
+			'type' => (!$range) ? 'number' : 'range',
649 649
 			'name' => $name,
650 650
 			'value' => $value,
651 651
 		);
@@ -680,7 +680,7 @@  discard block
 block discarded – undo
680 680
 	 * @param string $placeholder Default text to show if box is empty
681 681
 	 * @param unknown $attributes Additional attributes
682 682
 	 */
683
-	public function addDate($label = '', $name = '', $value = '', $required = false, $min = '', $max = '', $step = '',  $placeholder = '',  $attributes = array()) {
683
+	public function addDate($label = '', $name = '', $value = '', $required = false, $min = '', $max = '', $step = '', $placeholder = '', $attributes = array()) {
684 684
 		// Creating main data
685 685
 		$data = array(
686 686
 			'type' => 'date',
@@ -896,7 +896,7 @@  discard block
 block discarded – undo
896 896
 			$this->errors .= ' ' . $message . '.';
897 897
 			
898 898
 			// Extra message (title attribute)
899
-			if (isset($data['title']) and $data['title'] != '') $this->errors .= ' | '. 'MESSAGE' .': ' . $data['title'];
899
+			if (isset($data['title']) and $data['title'] != '') $this->errors .= ' | ' . 'MESSAGE' . ': ' . $data['title'];
900 900
 			
901 901
 			$this->errors .= '<br />';
902 902
 		}
@@ -913,11 +913,11 @@  discard block
 block discarded – undo
913 913
  */
914 914
 // More examples:
915 915
 // http://us2.php.net/manual/es/function.checkdate.php
916
-function is_date( $str ) {
916
+function is_date($str) {
917 917
 	// Try to execute date creator
918 918
 	try {
919
-		$dt = new DateTime( trim($str) );
920
-	} catch( Exception $e ) {
919
+		$dt = new DateTime(trim($str));
920
+	} catch (Exception $e) {
921 921
 		// If fails, it return false, date is incorrect
922 922
 		return false;
923 923
 	}
Please login to merge, or discard this patch.
Sistema/Ayudantes/CFPHPMenu.php 2 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
     
31 31
     
32 32
     function menu_ul($sel = 'inicio')
33
-   {
33
+    {
34 34
         $items = array(
35 35
             'inicio' => array(
36 36
                 'id'     => 'inicio',
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
     }
66 66
     
67 67
     function menu_p($sel = 'inicio', $separador = '')
68
-   {
68
+    {
69 69
         //$CI =& get_instance();
70 70
         $items = array(
71 71
             'inicio' => array(
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -53,14 +53,14 @@  discard block
 block discarded – undo
53 53
             )
54 54
         );
55 55
         
56
-        $menu = '<ul class="inline" >'.  PHP_EOL;
57
-        foreach($items as $item)
56
+        $menu = '<ul class="inline" >' . PHP_EOL;
57
+        foreach ($items as $item)
58 58
         {
59 59
             $current = (in_array($sel, $item)) ? ' class="current"' : '';
60
-            $id = (!empty($item['id'])) ? ' id="'.$item['id'].'"' : '';
61
-            $menu .= '<li'.$current.'><a href="'.$item['link'].'"'.$id.'>'.$item['title'].'</a></li>'."\n";
60
+            $id = (!empty($item['id'])) ? ' id="' . $item['id'] . '"' : '';
61
+            $menu .= '<li' . $current . '><a href="' . $item['link'] . '"' . $id . '>' . $item['title'] . '</a></li>' . "\n";
62 62
         }
63
-        $menu .= '</ul>'. PHP_EOL . PHP_EOL;
63
+        $menu .= '</ul>' . PHP_EOL . PHP_EOL;
64 64
         return $menu;
65 65
     }
66 66
     
@@ -91,19 +91,19 @@  discard block
 block discarded – undo
91 91
 
92 92
         $count = count($items);
93 93
         $i = 0;
94
-        $menu =  PHP_EOL .'<p class="bottom_nav">';
95
-        foreach($items as $item)
94
+        $menu = PHP_EOL . '<p class="bottom_nav">';
95
+        foreach ($items as $item)
96 96
         {
97 97
             $current = (in_array($sel, $item)) ? ' class="current"' : '';
98
-            $id = (!empty($item['id'])) ? ' id="'.$item['id'].'"' : '';
99
-            $menu .= '<a'.$current.' href="'.$item['link'].'"'.$id.'>'.$item['title'].'</a>';
98
+            $id = (!empty($item['id'])) ? ' id="' . $item['id'] . '"' : '';
99
+            $menu .= '<a' . $current . ' href="' . $item['link'] . '"' . $id . '>' . $item['title'] . '</a>';
100 100
             $i++;
101
-            if($count != $i)
101
+            if ($count != $i)
102 102
             {
103
-                $menu .= ' '.$separador.' ';
103
+                $menu .= ' ' . $separador . ' ';
104 104
             }
105 105
         }
106
-        $menu .= '</p>'. PHP_EOL ;
106
+        $menu .= '</p>' . PHP_EOL;
107 107
         return $menu;
108 108
     }
109 109
     
Please login to merge, or discard this patch.
Sistema/Ayudantes/CFPHPPaginador.php 2 patches
Indentation   +236 added lines, -236 removed lines patch added patch discarded remove patch
@@ -39,311 +39,311 @@
 block discarded – undo
39 39
  * (you can pass the most critical GETs manually if you like)
40 40
  */
41 41
  
42
- //Esta clase fue editada por programadores de Cf con la aprobacion de Ruben Arroyo
42
+    //Esta clase fue editada por programadores de Cf con la aprobacion de Ruben Arroyo
43 43
 
44 44
 namespace Sistema\Ayudantes;
45 45
 
46 46
 class Cf_PHPPaginator {
47
-	/*
47
+    /*
48 48
 	 * MAIN Settings (required)
49 49
 	 */
50 50
 	
51
-	/**
52
-	 * 
53
-	 * @total_records string Total of records to paginate (specify manually)
54
-	 */
55
-	public $total_records = 0;
51
+    /**
52
+     * 
53
+     * @total_records string Total of records to paginate (specify manually)
54
+     */
55
+    public $total_records = 0;
56 56
 	
57 57
 	
58
-	/*
58
+    /*
59 59
 	 * MAIN Settings (optional)
60 60
 	 */
61 61
 	
62
-	/**
63
-	 * @style string  Specify Class to define
64
-	 * @tutorial If is specified, it would create <div class="style"> otherwise it not create div
65
-	 */
66
-	public $style = '';
62
+    /**
63
+     * @style string  Specify Class to define
64
+     * @tutorial If is specified, it would create <div class="style"> otherwise it not create div
65
+     */
66
+    public $style = '';
67 67
 	
68
-	/**
69
-	 * @records number Max records to show on every page
70
-	 */
71
-	public $records = 20;
68
+    /**
69
+     * @records number Max records to show on every page
70
+     */
71
+    public $records = 20;
72 72
 	
73
-	/** 
74
-	 * @max_links number Maxium quantity of links to show before and after actual page
75
-	 * @example If current page is 4 and MAX is 2, it show "2 3 4 5 6"
76
-	 */
77
-	public $max_links = 3;
73
+    /** 
74
+     * @max_links number Maxium quantity of links to show before and after actual page
75
+     * @example If current page is 4 and MAX is 2, it show "2 3 4 5 6"
76
+     */
77
+    public $max_links = 3;
78 78
 	
79
-	/**
80
-	 * @get_name string Specify INDEX of GET that is used
81
-	 * 
82
-	 * It will load automatically the current page. 
83
-	 * If you like, you can specify manually in "$cur_page" 
84
-	 * (if you like filter previously or the script will not load directly from URL)  
85
-	 */
86
-	public $get_name = 'pag';
79
+    /**
80
+     * @get_name string Specify INDEX of GET that is used
81
+     * 
82
+     * It will load automatically the current page. 
83
+     * If you like, you can specify manually in "$cur_page" 
84
+     * (if you like filter previously or the script will not load directly from URL)  
85
+     */
86
+    public $get_name = 'pag';
87 87
 	
88
-	/**
89
-	 * @max_records number Specify maxium quantity of registers will be loaded. "0" disable this
90
-	 */
91
-	public $max_records = 0;
88
+    /**
89
+     * @max_records number Specify maxium quantity of registers will be loaded. "0" disable this
90
+     */
91
+    public $max_records = 0;
92 92
 	
93 93
 	
94
-	/**
95
-	 * @recicle_url boolean If is true, modify directly tue current URL to put the pagination (if not exist any, add &pag= to the end)
96
-	 * If is true, $url_start and $url_end will be ignored
97
-	 */
98
-	public $recicle_url = true;
94
+    /**
95
+     * @recicle_url boolean If is true, modify directly tue current URL to put the pagination (if not exist any, add &pag= to the end)
96
+     * If is true, $url_start and $url_end will be ignored
97
+     */
98
+    public $recicle_url = true;
99 99
 	
100
-	/**
101
-	 * @specific_get array Specify what GETs (and order) you like recicle.
102
-	 * Set array() to ALL (not recomended to avoid atacks DoS)  
103
-	 * Set '' for any
104
-	 * @example array('section', 'pag', 'subsection');
105
-	 * If you don't need 'pag' in the midle, you can ignore it.
106
-	 * WARNING: If the order is very important, use the pag at THE END of url   
107
-	 */
108
-	public $specific_get = '';
100
+    /**
101
+     * @specific_get array Specify what GETs (and order) you like recicle.
102
+     * Set array() to ALL (not recomended to avoid atacks DoS)  
103
+     * Set '' for any
104
+     * @example array('section', 'pag', 'subsection');
105
+     * If you don't need 'pag' in the midle, you can ignore it.
106
+     * WARNING: If the order is very important, use the pag at THE END of url   
107
+     */
108
+    public $specific_get = '';
109 109
 	
110
-	/**
111
-	 * @url_start string specify how the URL of every link start. IF $recicle_url is TRUE, this will be ignored 
112
-	 * @example If you use MOD_REWRITE or JAVASCRIPT, you can put "http://mywebsite.com/subdir/pag-" or "javascript:paginate("
113
-	 * 
114
-	 * This value will auto completed if you leave empty 
115
-	 */
116
-	public $url_start = '';
110
+    /**
111
+     * @url_start string specify how the URL of every link start. IF $recicle_url is TRUE, this will be ignored 
112
+     * @example If you use MOD_REWRITE or JAVASCRIPT, you can put "http://mywebsite.com/subdir/pag-" or "javascript:paginate("
113
+     * 
114
+     * This value will auto completed if you leave empty 
115
+     */
116
+    public $url_start = '';
117 117
 	
118
-	/**
119
-	 * @url_end string specify how the URL of every link ends. IF $recicle_url is TRUE, this will be ignored
120
-	 * @example If you use MOD_REWRITE or JAVASCRIPT, you can put "/" or ");"
121
-	 * 
122
-	 * This value will auto completed if you leave empty
123
-	 */
124
-	public $url_end = '';
118
+    /**
119
+     * @url_end string specify how the URL of every link ends. IF $recicle_url is TRUE, this will be ignored
120
+     * @example If you use MOD_REWRITE or JAVASCRIPT, you can put "/" or ");"
121
+     * 
122
+     * This value will auto completed if you leave empty
123
+     */
124
+    public $url_end = '';
125 125
 	
126 126
 	
127 127
 	
128
-	/*
128
+    /*
129 129
 	 * Design settings
130 130
 	 */
131 131
 	
132
-	// Icons to show "First | Previous | Next | Last"
133
-	//& laquo; = � | & lt; = <
132
+    // Icons to show "First | Previous | Next | Last"
133
+    //& laquo; = � | & lt; = <
134 134
     //& raquo; = � | & gt; = >
135 135
     // Leave empty '' to not show or ' ' to show empty
136
-	public $first = '[&lt;&lt;]';
137
-	public $previous = '[&lt;]';
138
-	public $next = '[&gt;]';
139
-	public $last = '[&gt;&gt;]';
136
+    public $first = '[&lt;&lt;]';
137
+    public $previous = '[&lt;]';
138
+    public $next = '[&gt;]';
139
+    public $last = '[&gt;&gt;]';
140 140
 	
141 141
 	
142
-	/*
142
+    /*
143 143
 	 * RETURNS FROM PAGINATOR and internal use
144 144
 	 */
145
-	// Return current page (auto loaded)
146
-	public $cur_page;
145
+    // Return current page (auto loaded)
146
+    public $cur_page;
147 147
 	
148
-	// original page loaded
149
-	// it contains the real value in GET (ex: -1, 5...) to compare later
150
-	public $original_page;
148
+    // original page loaded
149
+    // it contains the real value in GET (ex: -1, 5...) to compare later
150
+    public $original_page;
151 151
 	
152
-	// Return total pages
153
-	public $total_pages;
152
+    // Return total pages
153
+    public $total_pages;
154 154
 	
155
-	// LIMIT_START / Specify the first record of the page (ex, in page 3 and 20 records is record num 40)
156
-	// Limit max is $records
157
-	public $first_record;
155
+    // LIMIT_START / Specify the first record of the page (ex, in page 3 and 20 records is record num 40)
156
+    // Limit max is $records
157
+    public $first_record;
158 158
 	
159
-	// Specify limit to put directly in mysql query ( LIMIT 0,20 )
160
-	public $limit;
159
+    // Specify limit to put directly in mysql query ( LIMIT 0,20 )
160
+    public $limit;
161 161
 	
162 162
 	
163 163
 /*
164 164
  * Functions
165 165
  */
166
-	/**
167
-	 * @name paginate
168
-	 * @tutorial This function is called directly to load all params
169
-	 * @example $pag->paginate();
170
-	 */
171
-	public function paginate() {
172
-		$this->get(); // Filtering and obtaining variables
173
-		$this->calculate(); // Calc current page
174
-		$this->prepareUrl(); // Preparing URL to show
175
-	}
166
+    /**
167
+     * @name paginate
168
+     * @tutorial This function is called directly to load all params
169
+     * @example $pag->paginate();
170
+     */
171
+    public function paginate() {
172
+        $this->get(); // Filtering and obtaining variables
173
+        $this->calculate(); // Calc current page
174
+        $this->prepareUrl(); // Preparing URL to show
175
+    }
176 176
 	
177
-	/**
178
-	 * @name show
179
-	 * @tutorial Show links of pagination
180
-	 * @example $pag->show();
181
-	 */
182
-	public function show() {
183
-		// Prepare string with links
184
-		// Reading here variables is faster than "$this->var"
185
-		$cur_page = $this->cur_page; 
186
-		$url_start = $this->url_start;
187
-		$url_end = $this->url_end;
177
+    /**
178
+     * @name show
179
+     * @tutorial Show links of pagination
180
+     * @example $pag->show();
181
+     */
182
+    public function show() {
183
+        // Prepare string with links
184
+        // Reading here variables is faster than "$this->var"
185
+        $cur_page = $this->cur_page; 
186
+        $url_start = $this->url_start;
187
+        $url_end = $this->url_end;
188 188
 		
189
-		$start = $cur_page - $this->max_links;
190
-		$end = $cur_page + $this->max_links;
189
+        $start = $cur_page - $this->max_links;
190
+        $end = $cur_page + $this->max_links;
191 191
 		
192
-		if ($start < 1) $start = 1;
193
-		if ($end > $this->total_pages) $end = $this->total_pages;
192
+        if ($start < 1) $start = 1;
193
+        if ($end > $this->total_pages) $end = $this->total_pages;
194 194
 		
195
-		// Showing all clickable pages (create div if class is defined)
196
-		if ($this->style != '') $r = '<div class="'.$this->style.'">';
197
-		else $r = '';
195
+        // Showing all clickable pages (create div if class is defined)
196
+        if ($this->style != '') $r = '<div class="'.$this->style.'">';
197
+        else $r = '';
198 198
 		
199 199
 		
200
-		// First / previous
201
-		if ($this->cur_page > 1) {
202
-			if ($this->first != '') $r .= '<a class="first" href="' . $url_start . '1' . $url_end . '">'.$this->first.'</a> ';
203
-			if ($this->previous != '') $r .= '<a class="previous" href="' . $url_start . ($cur_page - 1) . $url_end . '">'.$this->previous.'</a> ';
204
-		}
200
+        // First / previous
201
+        if ($this->cur_page > 1) {
202
+            if ($this->first != '') $r .= '<a class="first" href="' . $url_start . '1' . $url_end . '">'.$this->first.'</a> ';
203
+            if ($this->previous != '') $r .= '<a class="previous" href="' . $url_start . ($cur_page - 1) . $url_end . '">'.$this->previous.'</a> ';
204
+        }
205 205
 		
206
-		// You can optimize this separating BEFORE and AFTER current page in two for (to avoid load "if" in each loop)
207
-		// but it would be difficult on changes
208
-		for ($n=$start; $n<=$end; $n++) {
209
-			if ($n != $cur_page) $r .= '<a class="link" href="'. $url_start . $n . $url_end . '">'.$n.'</a> ';
210
-			else $r .= '<a class="current">'.$n.'</a> ';
211
-		}
206
+        // You can optimize this separating BEFORE and AFTER current page in two for (to avoid load "if" in each loop)
207
+        // but it would be difficult on changes
208
+        for ($n=$start; $n<=$end; $n++) {
209
+            if ($n != $cur_page) $r .= '<a class="link" href="'. $url_start . $n . $url_end . '">'.$n.'</a> ';
210
+            else $r .= '<a class="current">'.$n.'</a> ';
211
+        }
212 212
 		
213
-		// next / last
214
-		if ($this->cur_page < $this->total_pages) {
215
-			if ($this->next != '') $r .= '<a class="next" href="' . $url_start . ($cur_page + 1) . $url_end . '">'.$this->next.'</a> ';
216
-			if ($this->last != '') $r .= '<a class="last" href="' . $url_start . $this->total_pages . $url_end .'">'.$this->last.'</a> ';
217
-		}
213
+        // next / last
214
+        if ($this->cur_page < $this->total_pages) {
215
+            if ($this->next != '') $r .= '<a class="next" href="' . $url_start . ($cur_page + 1) . $url_end . '">'.$this->next.'</a> ';
216
+            if ($this->last != '') $r .= '<a class="last" href="' . $url_start . $this->total_pages . $url_end .'">'.$this->last.'</a> ';
217
+        }
218 218
 		
219
-		// End div (if exist)
220
-		if ($this->style != '') $r .= '</div>';
219
+        // End div (if exist)
220
+        if ($this->style != '') $r .= '</div>';
221 221
 		
222
-		return $r;
223
-	}
222
+        return $r;
223
+    }
224 224
 	
225 225
 	
226
-	/**
227
-	 * @name get
228
-	 * @tutorial This function is autoloaded, it get the current page and filter number to avoid hackers
229
-	 */	 
230
-	private function get() {
231
-		if (!is_numeric($this->cur_page)) {
232
-			// First get the actual page, by default 1
233
-			$cur_page = isset($_GET[$this->get_name]) ? $_GET[$this->get_name] : 1;
234
-			$this->original_page = $cur_page;
226
+    /**
227
+     * @name get
228
+     * @tutorial This function is autoloaded, it get the current page and filter number to avoid hackers
229
+     */	 
230
+    private function get() {
231
+        if (!is_numeric($this->cur_page)) {
232
+            // First get the actual page, by default 1
233
+            $cur_page = isset($_GET[$this->get_name]) ? $_GET[$this->get_name] : 1;
234
+            $this->original_page = $cur_page;
235 235
 			
236
-			// Filter values
237
-			if (!is_numeric($cur_page) or $cur_page < 1) $cur_page = 1;
236
+            // Filter values
237
+            if (!is_numeric($cur_page) or $cur_page < 1) $cur_page = 1;
238 238
 			
239
-			// Set new filtered values (is faster this method)
240
-			$this->cur_page = $cur_page;
241
-		} else {
242
-			$this->original_page = $cur_page;
243
-		}
244
-	}
239
+            // Set new filtered values (is faster this method)
240
+            $this->cur_page = $cur_page;
241
+        } else {
242
+            $this->original_page = $cur_page;
243
+        }
244
+    }
245 245
 	
246
-	/**
247
-	 * @name calculate
248
-	 * @tutorial Do all calcs about current and last page
249
-	 */
250
-	private function calculate() {
251
-		// This vars are very used, so is faster do this
252
-		$max_records = $this->max_records;
253
-		$records = $this->records;
246
+    /**
247
+     * @name calculate
248
+     * @tutorial Do all calcs about current and last page
249
+     */
250
+    private function calculate() {
251
+        // This vars are very used, so is faster do this
252
+        $max_records = $this->max_records;
253
+        $records = $this->records;
254 254
 		
255
-		// Force maxium records loaded (only if is specified by user)
256
-		if ($max_records  > 0 and $max_records  > $total_records) 
257
-			$this->total_records = $max_records;
255
+        // Force maxium records loaded (only if is specified by user)
256
+        if ($max_records  > 0 and $max_records  > $total_records) 
257
+            $this->total_records = $max_records;
258 258
 		
259
-		// Calculate total pages that have
260
-		$total_pages = ceil($this->total_records / $records);
259
+        // Calculate total pages that have
260
+        $total_pages = ceil($this->total_records / $records);
261 261
 		
262
-		// Is correct current page?
263
-		if ($this->cur_page > $total_pages) $this->cur_page = $total_pages;
264
-		$this->total_pages = $total_pages;
262
+        // Is correct current page?
263
+        if ($this->cur_page > $total_pages) $this->cur_page = $total_pages;
264
+        $this->total_pages = $total_pages;
265 265
 		
266
-		// Specify LIMIT to do a query
267
-		$start = ($this->cur_page - 1) * $records;
266
+        // Specify LIMIT to do a query
267
+        $start = ($this->cur_page - 1) * $records;
268 268
 		
269
-		// Forcing maixum records to show (only if is specified by user)
270
-		if ($max_records > 0 and $records > $max_records) {
271
-			$records = $max_records;
272
-			$this->records = $records;
273
-		}
269
+        // Forcing maixum records to show (only if is specified by user)
270
+        if ($max_records > 0 and $records > $max_records) {
271
+            $records = $max_records;
272
+            $this->records = $records;
273
+        }
274 274
 			
275 275
 		
276
-		// Saving changes
277
-		$this->first_record = $start;
278
-		$this->limit = ' LIMIT '.$start.','.$records.' ';
279
-	}
276
+        // Saving changes
277
+        $this->first_record = $start;
278
+        $this->limit = ' LIMIT '.$start.','.$records.' ';
279
+    }
280 280
 	
281
-	/**
282
-	 * @name prepareUrl
283
-	 * @tutorial It prepare the url to show in each link, specified by user
284
-	 * If recicle URL is false, it will auto load $url_start and $url_end
285
-	 */
286
-	private function prepareUrl() {
287
-		// This script use three methods to recicle GET depending user selection
288
-		if ($this->recicle_url) {
289
-			// gonna to recicle the URL
290
-			$gets = $this->specific_get;
291
-			$get_name = $this->get_name;
281
+    /**
282
+     * @name prepareUrl
283
+     * @tutorial It prepare the url to show in each link, specified by user
284
+     * If recicle URL is false, it will auto load $url_start and $url_end
285
+     */
286
+    private function prepareUrl() {
287
+        // This script use three methods to recicle GET depending user selection
288
+        if ($this->recicle_url) {
289
+            // gonna to recicle the URL
290
+            $gets = $this->specific_get;
291
+            $get_name = $this->get_name;
292 292
 			
293
-			// If user specified an array
294
-			if (is_array($gets)) {
295
-				if (empty($gets)) {
296
-					// And is empty, we have to Recicle ALL GET
297
-					// To know that page needs to be replaced we will use the "original_page" (the real get)
298
-					// Cortamos "pag=2" para obtener lo que va antes y despues, as� poder modificar directamente ese pag=2 por la pagina actual
299
-					$query_string = explode($this->get_name.'='.$this->original_page, $_SERVER['QUERY_STRING']);
293
+            // If user specified an array
294
+            if (is_array($gets)) {
295
+                if (empty($gets)) {
296
+                    // And is empty, we have to Recicle ALL GET
297
+                    // To know that page needs to be replaced we will use the "original_page" (the real get)
298
+                    // Cortamos "pag=2" para obtener lo que va antes y despues, as� poder modificar directamente ese pag=2 por la pagina actual
299
+                    $query_string = explode($this->get_name.'='.$this->original_page, $_SERVER['QUERY_STRING']);
300 300
 					
301
-					// How start the new URL? To know it, we need to see the last character from current string
302
-					if (!in_array(substr($query_string[0], -1), array('?', '&'))) {
303
-						// Current string haven't any at end and it isn't "&" or "?" ?
304
-						// If initial string have one character at least it means that not is the first index 
305
-						if (isset($query_string[0][0])) $this->url_start = '?'.$query_string[0].'&';
306
-						else $this->url_start = '?'.$query_string[0];
307
-					} else {
308
-						// Current string already have ? or &,
309
-						$this->url_start = '?'.$query_string[0];
310
-					}
301
+                    // How start the new URL? To know it, we need to see the last character from current string
302
+                    if (!in_array(substr($query_string[0], -1), array('?', '&'))) {
303
+                        // Current string haven't any at end and it isn't "&" or "?" ?
304
+                        // If initial string have one character at least it means that not is the first index 
305
+                        if (isset($query_string[0][0])) $this->url_start = '?'.$query_string[0].'&';
306
+                        else $this->url_start = '?'.$query_string[0];
307
+                    } else {
308
+                        // Current string already have ? or &,
309
+                        $this->url_start = '?'.$query_string[0];
310
+                    }
311 311
 					
312
-					$this->url_end = isset($query_string[1]) ? $query_string[1] : '';
313
-				} else {
314
-					// Only specifics GET, reading all and finally leave in the same order
315
-					// With this we can clean all GET that we don't need (like hacker attempts)
316
-					$tmp = '';
317
-					$tmp_start = ''; // If we found the current page, we move here all $tmp
318
-					foreach ($gets as $get) {
319
-						if ($get != $get_name) {
320
-							// Trying to get the GET
321
-							if (isset($_GET[$get])) $tmp .= $get.'='.$_GET[$get].'&';
322
-						} else {
323
-							// Pour the $tmp content to $tmp_start
324
-							if ($tmp_start == '') $tmp_start .= '?';
325
-							$tmp_start .= $tmp;
326
-							$tmp = '';
327
-						}
328
-					}
312
+                    $this->url_end = isset($query_string[1]) ? $query_string[1] : '';
313
+                } else {
314
+                    // Only specifics GET, reading all and finally leave in the same order
315
+                    // With this we can clean all GET that we don't need (like hacker attempts)
316
+                    $tmp = '';
317
+                    $tmp_start = ''; // If we found the current page, we move here all $tmp
318
+                    foreach ($gets as $get) {
319
+                        if ($get != $get_name) {
320
+                            // Trying to get the GET
321
+                            if (isset($_GET[$get])) $tmp .= $get.'='.$_GET[$get].'&';
322
+                        } else {
323
+                            // Pour the $tmp content to $tmp_start
324
+                            if ($tmp_start == '') $tmp_start .= '?';
325
+                            $tmp_start .= $tmp;
326
+                            $tmp = '';
327
+                        }
328
+                    }
329 329
 					
330
-					// Finally, write the changes in the object
331
-					if ($tmp_start != '') {
332
-						// If have start and end
333
-						$this->url_start = $tmp_start;
334
-						$this->url_end = $tmp;
335
-					}
336
-					else $this->url_start = '?'.$tmp;
337
-				}
338
-			} else{
339
-				// Non recicle
340
-				$this->url_start = '?';
341
-				$this->url_end = ''; 
342
-			}
330
+                    // Finally, write the changes in the object
331
+                    if ($tmp_start != '') {
332
+                        // If have start and end
333
+                        $this->url_start = $tmp_start;
334
+                        $this->url_end = $tmp;
335
+                    }
336
+                    else $this->url_start = '?'.$tmp;
337
+                }
338
+            } else{
339
+                // Non recicle
340
+                $this->url_start = '?';
341
+                $this->url_end = ''; 
342
+            }
343 343
 			
344
-			// Add the pagination
345
-			$this->url_start .= $this->get_name.'=';
346
-		}
347
-	}
344
+            // Add the pagination
345
+            $this->url_start .= $this->get_name.'=';
346
+        }
347
+    }
348 348
 }
349 349
 ?>
350 350
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -193,27 +193,27 @@  discard block
 block discarded – undo
193 193
 		if ($end > $this->total_pages) $end = $this->total_pages;
194 194
 		
195 195
 		// Showing all clickable pages (create div if class is defined)
196
-		if ($this->style != '') $r = '<div class="'.$this->style.'">';
196
+		if ($this->style != '') $r = '<div class="' . $this->style . '">';
197 197
 		else $r = '';
198 198
 		
199 199
 		
200 200
 		// First / previous
201 201
 		if ($this->cur_page > 1) {
202
-			if ($this->first != '') $r .= '<a class="first" href="' . $url_start . '1' . $url_end . '">'.$this->first.'</a> ';
203
-			if ($this->previous != '') $r .= '<a class="previous" href="' . $url_start . ($cur_page - 1) . $url_end . '">'.$this->previous.'</a> ';
202
+			if ($this->first != '') $r .= '<a class="first" href="' . $url_start . '1' . $url_end . '">' . $this->first . '</a> ';
203
+			if ($this->previous != '') $r .= '<a class="previous" href="' . $url_start . ($cur_page - 1) . $url_end . '">' . $this->previous . '</a> ';
204 204
 		}
205 205
 		
206 206
 		// You can optimize this separating BEFORE and AFTER current page in two for (to avoid load "if" in each loop)
207 207
 		// but it would be difficult on changes
208
-		for ($n=$start; $n<=$end; $n++) {
209
-			if ($n != $cur_page) $r .= '<a class="link" href="'. $url_start . $n . $url_end . '">'.$n.'</a> ';
210
-			else $r .= '<a class="current">'.$n.'</a> ';
208
+		for ($n = $start; $n <= $end; $n++) {
209
+			if ($n != $cur_page) $r .= '<a class="link" href="' . $url_start . $n . $url_end . '">' . $n . '</a> ';
210
+			else $r .= '<a class="current">' . $n . '</a> ';
211 211
 		}
212 212
 		
213 213
 		// next / last
214 214
 		if ($this->cur_page < $this->total_pages) {
215
-			if ($this->next != '') $r .= '<a class="next" href="' . $url_start . ($cur_page + 1) . $url_end . '">'.$this->next.'</a> ';
216
-			if ($this->last != '') $r .= '<a class="last" href="' . $url_start . $this->total_pages . $url_end .'">'.$this->last.'</a> ';
215
+			if ($this->next != '') $r .= '<a class="next" href="' . $url_start . ($cur_page + 1) . $url_end . '">' . $this->next . '</a> ';
216
+			if ($this->last != '') $r .= '<a class="last" href="' . $url_start . $this->total_pages . $url_end . '">' . $this->last . '</a> ';
217 217
 		}
218 218
 		
219 219
 		// End div (if exist)
@@ -253,7 +253,7 @@  discard block
 block discarded – undo
253 253
 		$records = $this->records;
254 254
 		
255 255
 		// Force maxium records loaded (only if is specified by user)
256
-		if ($max_records  > 0 and $max_records  > $total_records) 
256
+		if ($max_records > 0 and $max_records > $total_records) 
257 257
 			$this->total_records = $max_records;
258 258
 		
259 259
 		// Calculate total pages that have
@@ -275,7 +275,7 @@  discard block
 block discarded – undo
275 275
 		
276 276
 		// Saving changes
277 277
 		$this->first_record = $start;
278
-		$this->limit = ' LIMIT '.$start.','.$records.' ';
278
+		$this->limit = ' LIMIT ' . $start . ',' . $records . ' ';
279 279
 	}
280 280
 	
281 281
 	/**
@@ -296,17 +296,17 @@  discard block
 block discarded – undo
296 296
 					// And is empty, we have to Recicle ALL GET
297 297
 					// To know that page needs to be replaced we will use the "original_page" (the real get)
298 298
 					// Cortamos "pag=2" para obtener lo que va antes y despues, as� poder modificar directamente ese pag=2 por la pagina actual
299
-					$query_string = explode($this->get_name.'='.$this->original_page, $_SERVER['QUERY_STRING']);
299
+					$query_string = explode($this->get_name . '=' . $this->original_page, $_SERVER['QUERY_STRING']);
300 300
 					
301 301
 					// How start the new URL? To know it, we need to see the last character from current string
302 302
 					if (!in_array(substr($query_string[0], -1), array('?', '&'))) {
303 303
 						// Current string haven't any at end and it isn't "&" or "?" ?
304 304
 						// If initial string have one character at least it means that not is the first index 
305
-						if (isset($query_string[0][0])) $this->url_start = '?'.$query_string[0].'&';
306
-						else $this->url_start = '?'.$query_string[0];
305
+						if (isset($query_string[0][0])) $this->url_start = '?' . $query_string[0] . '&';
306
+						else $this->url_start = '?' . $query_string[0];
307 307
 					} else {
308 308
 						// Current string already have ? or &,
309
-						$this->url_start = '?'.$query_string[0];
309
+						$this->url_start = '?' . $query_string[0];
310 310
 					}
311 311
 					
312 312
 					$this->url_end = isset($query_string[1]) ? $query_string[1] : '';
@@ -318,7 +318,7 @@  discard block
 block discarded – undo
318 318
 					foreach ($gets as $get) {
319 319
 						if ($get != $get_name) {
320 320
 							// Trying to get the GET
321
-							if (isset($_GET[$get])) $tmp .= $get.'='.$_GET[$get].'&';
321
+							if (isset($_GET[$get])) $tmp .= $get . '=' . $_GET[$get] . '&';
322 322
 						} else {
323 323
 							// Pour the $tmp content to $tmp_start
324 324
 							if ($tmp_start == '') $tmp_start .= '?';
@@ -333,16 +333,16 @@  discard block
 block discarded – undo
333 333
 						$this->url_start = $tmp_start;
334 334
 						$this->url_end = $tmp;
335 335
 					}
336
-					else $this->url_start = '?'.$tmp;
336
+					else $this->url_start = '?' . $tmp;
337 337
 				}
338
-			} else{
338
+			} else {
339 339
 				// Non recicle
340 340
 				$this->url_start = '?';
341 341
 				$this->url_end = ''; 
342 342
 			}
343 343
 			
344 344
 			// Add the pagination
345
-			$this->url_start .= $this->get_name.'=';
345
+			$this->url_start .= $this->get_name . '=';
346 346
 		}
347 347
 	}
348 348
 }
Please login to merge, or discard this patch.
Sistema/Ayudantes/CFPHPSeguridad.php 2 patches
Indentation   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -31,10 +31,10 @@  discard block
 block discarded – undo
31 31
     
32 32
     //xss funciones de mitigacion
33 33
     function xsseguro($texto,$encoding='UTF-8'){
34
-       return htmlspecialchars($texto,ENT_QUOTES | ENT_HTML401,$encoding);
34
+        return htmlspecialchars($texto,ENT_QUOTES | ENT_HTML401,$encoding);
35 35
     }
36 36
     function xecho($texto){
37
-       echo xsseguro($texto);
37
+        echo xsseguro($texto);
38 38
     }
39 39
     
40 40
     public function filtrarTexto($texto){
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
         $longitudCaracteres = strlen($caracteres);
55 55
         $cadenaAleatoria = '';
56 56
         for ($i = 0; $i < $length; $i++) {
57
-             $cadenaAleatoria .= $caracteres[rand(0, $longitudCaracteres - 1)];
57
+                $cadenaAleatoria .= $caracteres[rand(0, $longitudCaracteres - 1)];
58 58
         }
59 59
         return $cadenaAleatoria;
60 60
     }
@@ -80,14 +80,14 @@  discard block
 block discarded – undo
80 80
     
81 81
     function obtenerDireccionIP(){
82 82
     if (!empty($_SERVER ['HTTP_CLIENT_IP'] ))
83
-      $ip=$_SERVER ['HTTP_CLIENT_IP'];
83
+        $ip=$_SERVER ['HTTP_CLIENT_IP'];
84 84
     elseif (!empty($_SERVER ['HTTP_X_FORWARDED_FOR'] ))
85
-      $ip=$_SERVER ['HTTP_X_FORWARDED_FOR'];
85
+        $ip=$_SERVER ['HTTP_X_FORWARDED_FOR'];
86 86
     else
87
-      $ip=$_SERVER ['REMOTE_ADDR'];
87
+        $ip=$_SERVER ['REMOTE_ADDR'];
88 88
 
89 89
     return $ip;
90
-	}
90
+    }
91 91
 	
92 92
     function restringirIp($ip){
93 93
         $ipCliente = $this->obtenerDireccionIP();
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
         }
102 102
     }
103 103
 	
104
-	function restringirConjuntoIps($ips){
104
+    function restringirConjuntoIps($ips){
105 105
     $ipCliente = obtenerDireccionIP();
106 106
 
107 107
     if (in_array($ipCliente,$ips)){
@@ -111,9 +111,9 @@  discard block
 block discarded – undo
111 111
         header('location: http://direccion_envio_salida');
112 112
         exit;
113 113
     }
114
-	}
114
+    }
115 115
 	
116
-	function restringirRango(){
116
+    function restringirRango(){
117 117
     $ipCliente = obtenerDireccionIP();
118 118
 
119 119
     if(substr($ipCliente, 0, 8 ) == "150.214."){
@@ -123,20 +123,20 @@  discard block
 block discarded – undo
123 123
         header('location: http://direccion_envio_salida');
124 124
         exit;
125 125
     }
126
-	}
126
+    }
127 127
         
128 128
         
129 129
     /**
130
- *
131
- * @strip injection chars from email headers
132
- *
133
- * @param string $string
134
- *
135
- * return string
136
- *
137
- */
130
+     *
131
+     * @strip injection chars from email headers
132
+     *
133
+     * @param string $string
134
+     *
135
+     * return string
136
+     *
137
+     */
138 138
 function emailSeguro($cadena) {
139
-     return  preg_replace( '((?:\n|\r|\t|%0A|%0D|%08|%09)+)i' , '', $cadena );
139
+        return  preg_replace( '((?:\n|\r|\t|%0A|%0D|%08|%09)+)i' , '', $cadena );
140 140
 }
141 141
 
142 142
 /*** example usage 
Please login to merge, or discard this patch.
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -30,20 +30,20 @@  discard block
 block discarded – undo
30 30
 //Seguridad
31 31
     
32 32
     //xss funciones de mitigacion
33
-    function xsseguro($texto,$encoding='UTF-8'){
34
-       return htmlspecialchars($texto,ENT_QUOTES | ENT_HTML401,$encoding);
33
+    function xsseguro($texto, $encoding = 'UTF-8') {
34
+       return htmlspecialchars($texto, ENT_QUOTES | ENT_HTML401, $encoding);
35 35
     }
36
-    function xecho($texto){
36
+    function xecho($texto) {
37 37
        echo xsseguro($texto);
38 38
     }
39 39
     
40
-    public function filtrarTexto($texto){
40
+    public function filtrarTexto($texto) {
41 41
         return strip_tags($texto);
42 42
     }
43 43
     
44 44
      
45 45
     
46
-    public function filtrarCaracteresEspeciales($texto){
46
+    public function filtrarCaracteresEspeciales($texto) {
47 47
         return htmlspecialchars($texto, ENT_QUOTES);
48 48
     }
49 49
     
@@ -59,67 +59,67 @@  discard block
 block discarded – undo
59 59
         return $cadenaAleatoria;
60 60
     }
61 61
     // encriptacion
62
-    function cifrado($clave){
63
-        $cfi=sha1(md5($clave));
64
-        return $clave=Cf_KEY_MD5.$cfi;
62
+    function cifrado($clave) {
63
+        $cfi = sha1(md5($clave));
64
+        return $clave = Cf_KEY_MD5 . $cfi;
65 65
     }
66 66
     // Protecion CSRF
67 67
     public function generoTokenDeFormulario($formulario) {
68
-        $secreta =  Cf_CSRF_SECRET.$this->generarCadenaAleatoria();
68
+        $secreta = Cf_CSRF_SECRET . $this->generarCadenaAleatoria();
69 69
         $sid = session_id();
70
-        $token = md5($secreta.$sid.$formulario);
70
+        $token = md5($secreta . $sid . $formulario);
71 71
         return $token;
72 72
     }
73 73
     
74 74
     public function verificoTokenDeFormulario($formulario, $token) {
75
-        $secreta =  Cf_CSRF_SECRET.$this->generarCadenaAleatoria();
75
+        $secreta = Cf_CSRF_SECRET . $this->generarCadenaAleatoria();
76 76
         $sid = session_id();
77
-        $correcta = md5($secreta.$sid.$formulario);
77
+        $correcta = md5($secreta . $sid . $formulario);
78 78
         return ($token == $correcta);
79 79
     }
80 80
     
81
-    function obtenerDireccionIP(){
82
-    if (!empty($_SERVER ['HTTP_CLIENT_IP'] ))
83
-      $ip=$_SERVER ['HTTP_CLIENT_IP'];
84
-    elseif (!empty($_SERVER ['HTTP_X_FORWARDED_FOR'] ))
85
-      $ip=$_SERVER ['HTTP_X_FORWARDED_FOR'];
81
+    function obtenerDireccionIP() {
82
+    if (!empty($_SERVER ['HTTP_CLIENT_IP']))
83
+      $ip = $_SERVER ['HTTP_CLIENT_IP'];
84
+    elseif (!empty($_SERVER ['HTTP_X_FORWARDED_FOR']))
85
+      $ip = $_SERVER ['HTTP_X_FORWARDED_FOR'];
86 86
     else
87
-      $ip=$_SERVER ['REMOTE_ADDR'];
87
+      $ip = $_SERVER ['REMOTE_ADDR'];
88 88
 
89 89
     return $ip;
90 90
 	}
91 91
 	
92
-    function restringirIp($ip){
92
+    function restringirIp($ip) {
93 93
         $ipCliente = $this->obtenerDireccionIP();
94 94
 
95
-        if($ipCliente == $ip){
95
+        if ($ipCliente == $ip) {
96 96
         return true;
97 97
         }
98
-        else{
98
+        else {
99 99
         header('location: http://www.tusitioweb/redireccion');
100 100
         exit;
101 101
         }
102 102
     }
103 103
 	
104
-	function restringirConjuntoIps($ips){
104
+	function restringirConjuntoIps($ips) {
105 105
     $ipCliente = obtenerDireccionIP();
106 106
 
107
-    if (in_array($ipCliente,$ips)){
107
+    if (in_array($ipCliente, $ips)) {
108 108
         return true;
109 109
     }
110
-    else{
110
+    else {
111 111
         header('location: http://direccion_envio_salida');
112 112
         exit;
113 113
     }
114 114
 	}
115 115
 	
116
-	function restringirRango(){
116
+	function restringirRango() {
117 117
     $ipCliente = obtenerDireccionIP();
118 118
 
119
-    if(substr($ipCliente, 0, 8 ) == "150.214."){
119
+    if (substr($ipCliente, 0, 8) == "150.214.") {
120 120
         return true;
121 121
     }
122
-    else{
122
+    else {
123 123
         header('location: http://direccion_envio_salida');
124 124
         exit;
125 125
     }
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
  *
137 137
  */
138 138
 function emailSeguro($cadena) {
139
-     return  preg_replace( '((?:\n|\r|\t|%0A|%0D|%08|%09)+)i' , '', $cadena );
139
+     return  preg_replace('((?:\n|\r|\t|%0A|%0D|%08|%09)+)i', '', $cadena);
140 140
 }
141 141
 
142 142
 /*** example usage 
Please login to merge, or discard this patch.
Sistema/Ayudantes/CFPHPVinculos.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -31,5 +31,5 @@
 block discarded – undo
31 31
     
32 32
     $dominio = "http://www.my-site-domain.com/";
33 33
     return $dominio;
34
-   }
34
+    }
35 35
 }
36 36
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@
 block discarded – undo
27 27
 
28 28
 class CFPHPVinculos {
29 29
     
30
-    function get_dominio(){
30
+    function get_dominio() {
31 31
     
32 32
     $dominio = "http://www.my-site-domain.com/";
33 33
     return $dominio;
Please login to merge, or discard this patch.
Sistema/Nucleo/CFBootstrap.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -32,31 +32,31 @@
 block discarded – undo
32 32
     {
33 33
         $controlador = $peticion->getControlador() . 'Controlador';
34 34
         //definimos la ruta al controlador
35
-        $rutaControlador = SITE_ROOT . 'mvc' . DS .'controladores' . DS . $controlador . '.php';
35
+        $rutaControlador = SITE_ROOT . 'mvc' . DS . 'controladores' . DS . $controlador . '.php';
36 36
         $metodo = $peticion->getMetodo();
37 37
         $args = $peticion->getArgumentos();
38 38
         
39 39
         //verifcamos que el archivo existe con la funcion de PHP is_readable
40
-        if(is_readable($rutaControlador)){
40
+        if (is_readable($rutaControlador)) {
41 41
             require_once $rutaControlador;
42 42
             $controlador = new $controlador;
43 43
             
44
-            if(is_callable(array($controlador, $metodo))){
44
+            if (is_callable(array($controlador, $metodo))) {
45 45
                 $metodo = $peticion->getMetodo();
46 46
             }
47
-            else{
47
+            else {
48 48
                 $metodo = 'index';
49 49
             }
50 50
             
51
-            if(isset($args)){
51
+            if (isset($args)) {
52 52
                 call_user_func_array(array($controlador, $metodo), $args);
53 53
             }
54
-            else{
54
+            else {
55 55
                 call_user_func(array($controlador, $metodo));
56 56
             }
57 57
             
58 58
         } else {
59
-            header('Location: '.  Cf_BASE_URL.'error/');           
59
+            header('Location: ' . Cf_BASE_URL . 'error/');           
60 60
         }
61 61
     }
62 62
 }
63 63
\ No newline at end of file
Please login to merge, or discard this patch.
Sistema/Nucleo/CFControlador.php 2 patches
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
         $rutaLib = RUTA_LIBS . $libreria . '.php';
39 39
         if(is_readable($rutaLib)){
40 40
             require_once $rutaLib;
41
-           //echo 'libreria cargada';
41
+            //echo 'libreria cargada';
42 42
         }
43 43
         else {
44 44
             throw new Exception("houston tenemos un problema! al cargar libreria");
@@ -47,12 +47,12 @@  discard block
 block discarded – undo
47 47
     
48 48
     protected function cargaModelo($modelo){
49 49
         $modelo=$modelo.'Modelo';
50
-       $rutaMod = RUTA_MOD . $modelo . '.php';
50
+        $rutaMod = RUTA_MOD . $modelo . '.php';
51 51
         if(is_readable($rutaMod)){
52 52
             require_once $rutaMod;
53 53
             $modelo = new $modelo;
54 54
             return $modelo;
55
-           //echo 'modelo cargado';
55
+            //echo 'modelo cargado';
56 56
         }
57 57
         else {
58 58
             //echo $rutaMod;
@@ -64,10 +64,10 @@  discard block
 block discarded – undo
64 64
     }
65 65
     
66 66
     protected function cargaAyudante($ayudante){
67
-       $rutaAyudante = RUTA_AYUDANTES . $ayudante . '.php';
67
+        $rutaAyudante = RUTA_AYUDANTES . $ayudante . '.php';
68 68
         if(is_readable($rutaAyudante)){
69 69
             require_once $rutaAyudante;
70
-           //echo 'libreria cargada';
70
+            //echo 'libreria cargada';
71 71
         }
72 72
         else {
73 73
             throw new Exception("houston tenemos un problema! al cargar ayudante");
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -34,9 +34,9 @@  discard block
 block discarded – undo
34 34
         $this->_vista = new CFVista(new CFSolicitud);
35 35
     }
36 36
     
37
-    protected function cargaLib($libreria){
37
+    protected function cargaLib($libreria) {
38 38
         $rutaLib = RUTA_LIBS . $libreria . '.php';
39
-        if(is_readable($rutaLib)){
39
+        if (is_readable($rutaLib)) {
40 40
             require_once $rutaLib;
41 41
            //echo 'libreria cargada';
42 42
         }
@@ -45,10 +45,10 @@  discard block
 block discarded – undo
45 45
         }
46 46
     }
47 47
     
48
-    protected function cargaModelo($modelo){
49
-        $modelo=$modelo.'Modelo';
48
+    protected function cargaModelo($modelo) {
49
+        $modelo = $modelo . 'Modelo';
50 50
        $rutaMod = RUTA_MOD . $modelo . '.php';
51
-        if(is_readable($rutaMod)){
51
+        if (is_readable($rutaMod)) {
52 52
             require_once $rutaMod;
53 53
             $modelo = new $modelo;
54 54
             return $modelo;
@@ -63,9 +63,9 @@  discard block
 block discarded – undo
63 63
         }
64 64
     }
65 65
     
66
-    protected function cargaAyudante($ayudante){
66
+    protected function cargaAyudante($ayudante) {
67 67
        $rutaAyudante = RUTA_AYUDANTES . $ayudante . '.php';
68
-        if(is_readable($rutaAyudante)){
68
+        if (is_readable($rutaAyudante)) {
69 69
             require_once $rutaAyudante;
70 70
            //echo 'libreria cargada';
71 71
         }
Please login to merge, or discard this patch.