@@ -1,7 +1,7 @@ |
||
| 1 | 1 | <!-- Site footer --> |
| 2 | 2 | |
| 3 | 3 | |
| 4 | - <div class="footer fixedCf"> <?php echo CF_AP_CREDITOS; ?> --- Theme Inspinia </div> |
|
| 4 | + <div class="footer fixedCf"> <?php echo CF_AP_CREDITOS; ?> --- Theme Inspinia </div> |
|
| 5 | 5 | |
| 6 | 6 | |
| 7 | 7 | |
@@ -118,7 +118,7 @@ |
||
| 118 | 118 | $errorMessage = $this->errorMessage; |
| 119 | 119 | $multiselect = $this->multiselect; |
| 120 | 120 | |
| 121 | - return function ($selected) use ($choices, $errorMessage, $multiselect) { |
|
| 121 | + return function($selected) use ($choices, $errorMessage, $multiselect) { |
|
| 122 | 122 | // Collapse all spaces. |
| 123 | 123 | $selectedChoices = str_replace(' ', '', $selected); |
| 124 | 124 | |
@@ -40,7 +40,7 @@ |
||
| 40 | 40 | { |
| 41 | 41 | $default = $this->getDefault(); |
| 42 | 42 | |
| 43 | - return function ($answer) use ($default) { |
|
| 43 | + return function($answer) use ($default) { |
|
| 44 | 44 | if (is_bool($answer)) { |
| 45 | 45 | return $answer; |
| 46 | 46 | } |
@@ -268,8 +268,8 @@ |
||
| 268 | 268 | |
| 269 | 269 | $command = $this->getMock('TestCommand', array('execute')); |
| 270 | 270 | $command->expects($this->once()) |
| 271 | - ->method('execute') |
|
| 272 | - ->will($this->returnValue('2.3')); |
|
| 271 | + ->method('execute') |
|
| 272 | + ->will($this->returnValue('2.3')); |
|
| 273 | 273 | $exitCode = $command->run(new StringInput(''), new NullOutput()); |
| 274 | 274 | $this->assertSame(2, $exitCode, '->run() returns integer exit code (casts numeric to int)'); |
| 275 | 275 | } |
@@ -284,7 +284,7 @@ |
||
| 284 | 284 | public function testSetCode() |
| 285 | 285 | { |
| 286 | 286 | $command = new \TestCommand(); |
| 287 | - $ret = $command->setCode(function (InputInterface $input, OutputInterface $output) { |
|
| 287 | + $ret = $command->setCode(function(InputInterface $input, OutputInterface $output) { |
|
| 288 | 288 | $output->writeln('from the code...'); |
| 289 | 289 | }); |
| 290 | 290 | $this->assertEquals($command, $ret, '->setCode() implements a fluent interface'); |
@@ -173,7 +173,7 @@ |
||
| 173 | 173 | $dialog->setHelperSet($helperSet); |
| 174 | 174 | |
| 175 | 175 | $error = 'This is not a color!'; |
| 176 | - $validator = function ($color) use ($error) { |
|
| 176 | + $validator = function($color) use ($error) { |
|
| 177 | 177 | if (!in_array($color, array('white', 'black'))) { |
| 178 | 178 | throw new \InvalidArgumentException($error); |
| 179 | 179 | } |
@@ -51,6 +51,11 @@ discard block |
||
| 51 | 51 | /* public function __destruct() { |
| 52 | 52 | session_regenerate_id(true); |
| 53 | 53 | }*/ |
| 54 | + |
|
| 55 | + /** |
|
| 56 | + * @param string $session_name |
|
| 57 | + * @param false|string $secure |
|
| 58 | + */ |
|
| 54 | 59 | function iniciarSesion($session_name, $secure) { |
| 55 | 60 | // Make sure the session cookie is not accessable via javascript. |
| 56 | 61 | $httpunico = true; |
@@ -136,6 +141,9 @@ discard block |
||
| 136 | 141 | return true; |
| 137 | 142 | } |
| 138 | 143 | |
| 144 | + /** |
|
| 145 | + * @param string $id |
|
| 146 | + */ |
|
| 139 | 147 | function destruir($id) { |
| 140 | 148 | if(!isset($this->delete_stmt)) { |
| 141 | 149 | $this->delete_stmt = $this->db->prepare("DELETE FROM sesiones WHERE id = ?"); |
@@ -41,155 +41,155 @@ |
||
| 41 | 41 | private $bdchar = CF_BD_CHAR; |
| 42 | 42 | private $bdconector = CF_BD_CONECTOR; |
| 43 | 43 | |
| 44 | - public function __construct() { |
|
| 45 | - session_regenerate_id(true); |
|
| 46 | - // set our custom session functions. |
|
| 47 | - session_set_save_handler(array($this, 'abrir'), array($this, 'cerrar'), array($this, 'leer'), array($this, 'escribir'), array($this, 'destruir'), array($this, 'gc')); |
|
| 48 | - // This line prevents unexpected effects when using objects as save handlers. |
|
| 49 | - register_shutdown_function('session_write_close'); |
|
| 50 | - } |
|
| 51 | - /* public function __destruct() { |
|
| 44 | + public function __construct() { |
|
| 45 | + session_regenerate_id(true); |
|
| 46 | + // set our custom session functions. |
|
| 47 | + session_set_save_handler(array($this, 'abrir'), array($this, 'cerrar'), array($this, 'leer'), array($this, 'escribir'), array($this, 'destruir'), array($this, 'gc')); |
|
| 48 | + // This line prevents unexpected effects when using objects as save handlers. |
|
| 49 | + register_shutdown_function('session_write_close'); |
|
| 50 | + } |
|
| 51 | + /* public function __destruct() { |
|
| 52 | 52 | session_regenerate_id(true); |
| 53 | 53 | }*/ |
| 54 | - function iniciarSesion($session_name, $secure) { |
|
| 55 | - // Make sure the session cookie is not accessable via javascript. |
|
| 56 | - $httpunico = true; |
|
| 54 | + function iniciarSesion($session_name, $secure) { |
|
| 55 | + // Make sure the session cookie is not accessable via javascript. |
|
| 56 | + $httpunico = true; |
|
| 57 | 57 | |
| 58 | - // Hash algorithm to use for the sessionid. (use hash_algos() to get a list of available hashes.) |
|
| 59 | - $sesion_hash = 'sha512'; |
|
| 58 | + // Hash algorithm to use for the sessionid. (use hash_algos() to get a list of available hashes.) |
|
| 59 | + $sesion_hash = 'sha512'; |
|
| 60 | 60 | |
| 61 | - // Check if hash is available |
|
| 62 | - if (in_array($sesion_hash, hash_algos())) { |
|
| 61 | + // Check if hash is available |
|
| 62 | + if (in_array($sesion_hash, hash_algos())) { |
|
| 63 | 63 | // Set the has function. |
| 64 | 64 | ini_set('session.hash_function', $sesion_hash); |
| 65 | - } |
|
| 66 | - // How many bits per character of the hash. |
|
| 67 | - // The possible values are '4' (0-9, a-f), '5' (0-9, a-v), and '6' (0-9, a-z, A-Z, "-", ","). |
|
| 68 | - ini_set('session.hash_bits_per_character', 5); |
|
| 69 | - |
|
| 70 | - // Force the session to only use cookies, not URL variables. |
|
| 71 | - ini_set('session.use_only_cookies', 1); |
|
| 72 | - |
|
| 73 | - // Get session cookie parameters |
|
| 74 | - $cookieParams = session_get_cookie_params(); |
|
| 75 | - // Set the parameters |
|
| 76 | - session_set_cookie_params($cookieParams["lifetime"], $cookieParams["path"], $cookieParams["domain"], $secure, $httpunico); |
|
| 77 | - // Change the session name |
|
| 78 | - session_name($session_name); |
|
| 79 | - // Now we cat start the session |
|
| 80 | - session_start(); |
|
| 65 | + } |
|
| 66 | + // How many bits per character of the hash. |
|
| 67 | + // The possible values are '4' (0-9, a-f), '5' (0-9, a-v), and '6' (0-9, a-z, A-Z, "-", ","). |
|
| 68 | + ini_set('session.hash_bits_per_character', 5); |
|
| 69 | + |
|
| 70 | + // Force the session to only use cookies, not URL variables. |
|
| 71 | + ini_set('session.use_only_cookies', 1); |
|
| 72 | + |
|
| 73 | + // Get session cookie parameters |
|
| 74 | + $cookieParams = session_get_cookie_params(); |
|
| 75 | + // Set the parameters |
|
| 76 | + session_set_cookie_params($cookieParams["lifetime"], $cookieParams["path"], $cookieParams["domain"], $secure, $httpunico); |
|
| 77 | + // Change the session name |
|
| 78 | + session_name($session_name); |
|
| 79 | + // Now we cat start the session |
|
| 80 | + session_start(); |
|
| 81 | 81 | |
| 82 | - // This line regenerates the session and delete the old one. |
|
| 83 | - // It also generates a new encryption key in the database. |
|
| 82 | + // This line regenerates the session and delete the old one. |
|
| 83 | + // It also generates a new encryption key in the database. |
|
| 84 | 84 | |
| 85 | - } |
|
| 85 | + } |
|
| 86 | 86 | |
| 87 | 87 | // ingrese la informacion de conexion a su base de datos, debe ser igual a la que esta en CFConfiguracion.php |
| 88 | - function abrir() { |
|
| 89 | - $host = $this->host; |
|
| 90 | - $user = $this->usuario; |
|
| 91 | - $pass = $this->clave; |
|
| 92 | - $name = $this->bdnombre; |
|
| 88 | + function abrir() { |
|
| 89 | + $host = $this->host; |
|
| 90 | + $user = $this->usuario; |
|
| 91 | + $pass = $this->clave; |
|
| 92 | + $name = $this->bdnombre; |
|
| 93 | 93 | |
| 94 | - $mysqli = new \mysqli($host, $user, $pass, $name); |
|
| 95 | - $this->db = $mysqli; |
|
| 96 | - return true; |
|
| 97 | - } |
|
| 94 | + $mysqli = new \mysqli($host, $user, $pass, $name); |
|
| 95 | + $this->db = $mysqli; |
|
| 96 | + return true; |
|
| 97 | + } |
|
| 98 | 98 | |
| 99 | - function cerrar() { |
|
| 100 | - $this->db->close(); |
|
| 101 | - return true; |
|
| 102 | - } |
|
| 99 | + function cerrar() { |
|
| 100 | + $this->db->close(); |
|
| 101 | + return true; |
|
| 102 | + } |
|
| 103 | 103 | |
| 104 | 104 | |
| 105 | - function leer($id) { |
|
| 106 | - if(!isset($this->read_stmt)) { |
|
| 107 | - $this->read_stmt = $this->db->prepare("SELECT data FROM sesiones WHERE id = ? LIMIT 1"); |
|
| 108 | - } |
|
| 109 | - $this->read_stmt->bind_param('s', $id); |
|
| 110 | - $this->read_stmt->execute(); |
|
| 111 | - $this->read_stmt->store_result(); |
|
| 112 | - $this->read_stmt->bind_result($data); |
|
| 113 | - $this->read_stmt->fetch(); |
|
| 114 | - $key = $this->getkey($id); |
|
| 115 | - $data = $this->decrypt($data, $key); |
|
| 116 | - return $data; |
|
| 117 | - } |
|
| 105 | + function leer($id) { |
|
| 106 | + if(!isset($this->read_stmt)) { |
|
| 107 | + $this->read_stmt = $this->db->prepare("SELECT data FROM sesiones WHERE id = ? LIMIT 1"); |
|
| 108 | + } |
|
| 109 | + $this->read_stmt->bind_param('s', $id); |
|
| 110 | + $this->read_stmt->execute(); |
|
| 111 | + $this->read_stmt->store_result(); |
|
| 112 | + $this->read_stmt->bind_result($data); |
|
| 113 | + $this->read_stmt->fetch(); |
|
| 114 | + $key = $this->getkey($id); |
|
| 115 | + $data = $this->decrypt($data, $key); |
|
| 116 | + return $data; |
|
| 117 | + } |
|
| 118 | 118 | |
| 119 | 119 | |
| 120 | 120 | |
| 121 | 121 | |
| 122 | 122 | |
| 123 | - function escribir($id, $data) { |
|
| 124 | - // Get unique key |
|
| 125 | - $key = $this->getkey($id); |
|
| 126 | - // Encrypt the data |
|
| 127 | - $data = $this->encrypt($data, $key); |
|
| 123 | + function escribir($id, $data) { |
|
| 124 | + // Get unique key |
|
| 125 | + $key = $this->getkey($id); |
|
| 126 | + // Encrypt the data |
|
| 127 | + $data = $this->encrypt($data, $key); |
|
| 128 | 128 | |
| 129 | - $time = time(); |
|
| 130 | - if(!isset($this->w_stmt)) { |
|
| 131 | - $this->w_stmt = $this->db->prepare("REPLACE INTO sesiones (id, set_time, data, session_key) VALUES (?, ?, ?, ?)"); |
|
| 132 | - } |
|
| 129 | + $time = time(); |
|
| 130 | + if(!isset($this->w_stmt)) { |
|
| 131 | + $this->w_stmt = $this->db->prepare("REPLACE INTO sesiones (id, set_time, data, session_key) VALUES (?, ?, ?, ?)"); |
|
| 132 | + } |
|
| 133 | 133 | |
| 134 | - $this->w_stmt->bind_param('siss', $id, $time, $data, $key); |
|
| 135 | - $this->w_stmt->execute(); |
|
| 136 | - return true; |
|
| 137 | - } |
|
| 138 | - |
|
| 139 | - function destruir($id) { |
|
| 140 | - if(!isset($this->delete_stmt)) { |
|
| 141 | - $this->delete_stmt = $this->db->prepare("DELETE FROM sesiones WHERE id = ?"); |
|
| 142 | - } |
|
| 143 | - $this->delete_stmt->bind_param('s', $id); |
|
| 144 | - $this->delete_stmt->execute(); |
|
| 145 | - return true; |
|
| 146 | - } |
|
| 147 | - |
|
| 148 | - function gc($max) { |
|
| 149 | - if(!isset($this->gc_stmt)) { |
|
| 150 | - $this->gc_stmt = $this->db->prepare("DELETE FROM sesiones WHERE set_time < ?"); |
|
| 151 | - } |
|
| 152 | - $old = time() - $max; |
|
| 153 | - $this->gc_stmt->bind_param('s', $old); |
|
| 154 | - $this->gc_stmt->execute(); |
|
| 155 | - return true; |
|
| 156 | - } |
|
| 157 | - |
|
| 158 | - private function getkey($id) { |
|
| 134 | + $this->w_stmt->bind_param('siss', $id, $time, $data, $key); |
|
| 135 | + $this->w_stmt->execute(); |
|
| 136 | + return true; |
|
| 137 | + } |
|
| 138 | + |
|
| 139 | + function destruir($id) { |
|
| 140 | + if(!isset($this->delete_stmt)) { |
|
| 141 | + $this->delete_stmt = $this->db->prepare("DELETE FROM sesiones WHERE id = ?"); |
|
| 142 | + } |
|
| 143 | + $this->delete_stmt->bind_param('s', $id); |
|
| 144 | + $this->delete_stmt->execute(); |
|
| 145 | + return true; |
|
| 146 | + } |
|
| 147 | + |
|
| 148 | + function gc($max) { |
|
| 149 | + if(!isset($this->gc_stmt)) { |
|
| 150 | + $this->gc_stmt = $this->db->prepare("DELETE FROM sesiones WHERE set_time < ?"); |
|
| 151 | + } |
|
| 152 | + $old = time() - $max; |
|
| 153 | + $this->gc_stmt->bind_param('s', $old); |
|
| 154 | + $this->gc_stmt->execute(); |
|
| 155 | + return true; |
|
| 156 | + } |
|
| 157 | + |
|
| 158 | + private function getkey($id) { |
|
| 159 | 159 | |
| 160 | 160 | |
| 161 | - if(!isset($this->key_stmt)) { |
|
| 162 | - $this->key_stmt = $this->db->prepare("SELECT session_key FROM sesiones WHERE id = ? LIMIT 1"); |
|
| 163 | - } |
|
| 164 | - $this->key_stmt->bind_param('s', $id); |
|
| 165 | - $this->key_stmt->execute(); |
|
| 166 | - $this->key_stmt->store_result(); |
|
| 167 | - if($this->key_stmt->num_rows == 1) { |
|
| 168 | - $this->key_stmt->bind_result($key); |
|
| 169 | - $this->key_stmt->fetch(); |
|
| 170 | - return $key; |
|
| 171 | - } else { |
|
| 172 | - $random_key = hash('sha512', uniqid(mt_rand(1, mt_getrandmax()), true)); |
|
| 173 | - return $random_key; |
|
| 174 | - } |
|
| 175 | - } |
|
| 176 | - |
|
| 177 | - private function encrypt($data, $key) { |
|
| 178 | - $salt = 'cH!swe!retReGu7W6bEDRup7usuDUh9THeD2CHeGE*ewr4n39=E@rAsp7c-Ph@pH'; |
|
| 179 | - $key = substr(hash('sha256', $salt.$key.$salt), 0, 32); |
|
| 180 | - $iv_size = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB); |
|
| 181 | - $iv = mcrypt_create_iv($iv_size, MCRYPT_RAND); |
|
| 182 | - $encrypted = base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_256, $key, $data, MCRYPT_MODE_ECB, $iv)); |
|
| 183 | - return $encrypted; |
|
| 184 | - } |
|
| 185 | - private function decrypt($data, $key) { |
|
| 186 | - $salt = 'cH!swe!retReGu7W6bEDRup7usuDUh9THeD2CHeGE*ewr4n39=E@rAsp7c-Ph@pH'; |
|
| 187 | - $key = substr(hash('sha256', $salt.$key.$salt), 0, 32); |
|
| 188 | - $iv_size = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB); |
|
| 189 | - $iv = mcrypt_create_iv($iv_size, MCRYPT_RAND); |
|
| 190 | - $decrypted = mcrypt_decrypt(MCRYPT_RIJNDAEL_256, $key, base64_decode($data), MCRYPT_MODE_ECB, $iv); |
|
| 191 | - return $decrypted; |
|
| 192 | - } |
|
| 161 | + if(!isset($this->key_stmt)) { |
|
| 162 | + $this->key_stmt = $this->db->prepare("SELECT session_key FROM sesiones WHERE id = ? LIMIT 1"); |
|
| 163 | + } |
|
| 164 | + $this->key_stmt->bind_param('s', $id); |
|
| 165 | + $this->key_stmt->execute(); |
|
| 166 | + $this->key_stmt->store_result(); |
|
| 167 | + if($this->key_stmt->num_rows == 1) { |
|
| 168 | + $this->key_stmt->bind_result($key); |
|
| 169 | + $this->key_stmt->fetch(); |
|
| 170 | + return $key; |
|
| 171 | + } else { |
|
| 172 | + $random_key = hash('sha512', uniqid(mt_rand(1, mt_getrandmax()), true)); |
|
| 173 | + return $random_key; |
|
| 174 | + } |
|
| 175 | + } |
|
| 176 | + |
|
| 177 | + private function encrypt($data, $key) { |
|
| 178 | + $salt = 'cH!swe!retReGu7W6bEDRup7usuDUh9THeD2CHeGE*ewr4n39=E@rAsp7c-Ph@pH'; |
|
| 179 | + $key = substr(hash('sha256', $salt.$key.$salt), 0, 32); |
|
| 180 | + $iv_size = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB); |
|
| 181 | + $iv = mcrypt_create_iv($iv_size, MCRYPT_RAND); |
|
| 182 | + $encrypted = base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_256, $key, $data, MCRYPT_MODE_ECB, $iv)); |
|
| 183 | + return $encrypted; |
|
| 184 | + } |
|
| 185 | + private function decrypt($data, $key) { |
|
| 186 | + $salt = 'cH!swe!retReGu7W6bEDRup7usuDUh9THeD2CHeGE*ewr4n39=E@rAsp7c-Ph@pH'; |
|
| 187 | + $key = substr(hash('sha256', $salt.$key.$salt), 0, 32); |
|
| 188 | + $iv_size = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB); |
|
| 189 | + $iv = mcrypt_create_iv($iv_size, MCRYPT_RAND); |
|
| 190 | + $decrypted = mcrypt_decrypt(MCRYPT_RIJNDAEL_256, $key, base64_decode($data), MCRYPT_MODE_ECB, $iv); |
|
| 191 | + return $decrypted; |
|
| 192 | + } |
|
| 193 | 193 | |
| 194 | 194 | } |
| 195 | 195 | |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | |
| 104 | 104 | |
| 105 | 105 | function leer($id) { |
| 106 | - if(!isset($this->read_stmt)) { |
|
| 106 | + if (!isset($this->read_stmt)) { |
|
| 107 | 107 | $this->read_stmt = $this->db->prepare("SELECT data FROM sesiones WHERE id = ? LIMIT 1"); |
| 108 | 108 | } |
| 109 | 109 | $this->read_stmt->bind_param('s', $id); |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | $data = $this->encrypt($data, $key); |
| 128 | 128 | |
| 129 | 129 | $time = time(); |
| 130 | - if(!isset($this->w_stmt)) { |
|
| 130 | + if (!isset($this->w_stmt)) { |
|
| 131 | 131 | $this->w_stmt = $this->db->prepare("REPLACE INTO sesiones (id, set_time, data, session_key) VALUES (?, ?, ?, ?)"); |
| 132 | 132 | } |
| 133 | 133 | |
@@ -137,7 +137,7 @@ discard block |
||
| 137 | 137 | } |
| 138 | 138 | |
| 139 | 139 | function destruir($id) { |
| 140 | - if(!isset($this->delete_stmt)) { |
|
| 140 | + if (!isset($this->delete_stmt)) { |
|
| 141 | 141 | $this->delete_stmt = $this->db->prepare("DELETE FROM sesiones WHERE id = ?"); |
| 142 | 142 | } |
| 143 | 143 | $this->delete_stmt->bind_param('s', $id); |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | } |
| 147 | 147 | |
| 148 | 148 | function gc($max) { |
| 149 | - if(!isset($this->gc_stmt)) { |
|
| 149 | + if (!isset($this->gc_stmt)) { |
|
| 150 | 150 | $this->gc_stmt = $this->db->prepare("DELETE FROM sesiones WHERE set_time < ?"); |
| 151 | 151 | } |
| 152 | 152 | $old = time() - $max; |
@@ -158,13 +158,13 @@ discard block |
||
| 158 | 158 | private function getkey($id) { |
| 159 | 159 | |
| 160 | 160 | |
| 161 | - if(!isset($this->key_stmt)) { |
|
| 161 | + if (!isset($this->key_stmt)) { |
|
| 162 | 162 | $this->key_stmt = $this->db->prepare("SELECT session_key FROM sesiones WHERE id = ? LIMIT 1"); |
| 163 | 163 | } |
| 164 | 164 | $this->key_stmt->bind_param('s', $id); |
| 165 | 165 | $this->key_stmt->execute(); |
| 166 | 166 | $this->key_stmt->store_result(); |
| 167 | - if($this->key_stmt->num_rows == 1) { |
|
| 167 | + if ($this->key_stmt->num_rows == 1) { |
|
| 168 | 168 | $this->key_stmt->bind_result($key); |
| 169 | 169 | $this->key_stmt->fetch(); |
| 170 | 170 | return $key; |
@@ -64,11 +64,11 @@ |
||
| 64 | 64 | if($_SESSION['nivel']==1){ |
| 65 | 65 | $this->_vista->titulo = 'CalimaFramework'; |
| 66 | 66 | $this->_vista->imprimirVista('index', 'data'); |
| 67 | - }else{ |
|
| 67 | + } else{ |
|
| 68 | 68 | $this->_ayuda->redireccionUrl('usuario'); |
| 69 | 69 | } |
| 70 | 70 | |
| 71 | - }elseif (Cf_CONFIG_INICIO=='false') { |
|
| 71 | + } elseif (Cf_CONFIG_INICIO=='false') { |
|
| 72 | 72 | |
| 73 | 73 | $this->_vista->titulo = 'CalimaFramework'; |
| 74 | 74 | $this->_vista->imprimirVista('index', 'data'); |
@@ -46,12 +46,12 @@ discard block |
||
| 46 | 46 | public function __construct() { |
| 47 | 47 | parent::__construct(); |
| 48 | 48 | |
| 49 | - $this->_ayuda= new Sisayu\CFPHPAyuda; |
|
| 49 | + $this->_ayuda = new Sisayu\CFPHPAyuda; |
|
| 50 | 50 | //$this->cargaAyudante('CfPHPAyuda'); |
| 51 | 51 | //$this->cargaAyudante('CfPHPSeguridad'); |
| 52 | - $this->_seg= new Sisayu\CFPHPSeguridad; |
|
| 52 | + $this->_seg = new Sisayu\CFPHPSeguridad; |
|
| 53 | 53 | |
| 54 | - $this->_sesion=new Sisnuc\CFSesion(); |
|
| 54 | + $this->_sesion = new Sisnuc\CFSesion(); |
|
| 55 | 55 | |
| 56 | 56 | } |
| 57 | 57 | |
@@ -59,16 +59,16 @@ discard block |
||
| 59 | 59 | { |
| 60 | 60 | // Se verifica que en el archivo de configuracion.php la constante Cf_CONFIG_INICIO==true |
| 61 | 61 | //Si esta en True se lanza el instalador de Cf |
| 62 | - if(Cf_CONFIG_INICIO==true){ |
|
| 62 | + if (Cf_CONFIG_INICIO == true) { |
|
| 63 | 63 | $this->_sesion->iniciarSesion('_s', false); |
| 64 | - if($_SESSION['nivel']==1){ |
|
| 64 | + if ($_SESSION['nivel'] == 1) { |
|
| 65 | 65 | $this->_vista->titulo = 'CalimaFramework'; |
| 66 | 66 | $this->_vista->imprimirVista('index', 'data'); |
| 67 | - }else{ |
|
| 67 | + } else { |
|
| 68 | 68 | $this->_ayuda->redireccionUrl('usuario'); |
| 69 | 69 | } |
| 70 | 70 | |
| 71 | - }elseif (Cf_CONFIG_INICIO=='false') { |
|
| 71 | + }elseif (Cf_CONFIG_INICIO == 'false') { |
|
| 72 | 72 | |
| 73 | 73 | $this->_vista->titulo = 'CalimaFramework'; |
| 74 | 74 | $this->_vista->imprimirVista('index', 'data'); |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | //verificamos la version de php en tu servidor web o local |
| 28 | 28 | if (version_compare(PHP_VERSION, '5.3.20', '<')) |
| 29 | 29 | { |
| 30 | - die('Su Hosting tiene una version < a PHP 5.3.20 debes actualizar para esta version de Calima. su version actual de PHP es: '.PHP_VERSION); |
|
| 30 | + die('Su Hosting tiene una version < a PHP 5.3.20 debes actualizar para esta version de Calima. su version actual de PHP es: '.PHP_VERSION); |
|
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | //Cargamos los Espacios de nombres para el nucleo y los ayudantes |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | |
| 49 | 49 | $this->_ayuda= new Sisayu\CFPHPAyuda; |
| 50 | 50 | //$this->cargaAyudante('CfPHPAyuda'); |
| 51 | - //$this->cargaAyudante('CfPHPSeguridad'); |
|
| 51 | + //$this->cargaAyudante('CfPHPSeguridad'); |
|
| 52 | 52 | $this->_seg= new Sisayu\CFPHPSeguridad; |
| 53 | 53 | |
| 54 | 54 | $this->_sesion=new Sisnuc\CFSesion(); |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | private $_argumentos; |
| 33 | 33 | |
| 34 | 34 | public function __construct() { |
| 35 | - if(isset($_GET['url'])){ |
|
| 35 | + if (isset($_GET['url'])) { |
|
| 36 | 36 | $url = filter_input(INPUT_GET, 'url', FILTER_SANITIZE_URL); |
| 37 | 37 | $url = explode('/', $url); |
| 38 | 38 | $url = array_filter($url); |
@@ -46,15 +46,15 @@ discard block |
||
| 46 | 46 | $this->setArgumentos($url); |
| 47 | 47 | } |
| 48 | 48 | |
| 49 | - if(!$this->getControlador()){ |
|
| 49 | + if (!$this->getControlador()) { |
|
| 50 | 50 | $this->setControlador(CONTROLADOR_INICIAL); |
| 51 | 51 | } |
| 52 | 52 | |
| 53 | - if(!$this->getMetodo()){ |
|
| 53 | + if (!$this->getMetodo()) { |
|
| 54 | 54 | $this->setMetodo('index'); |
| 55 | 55 | } |
| 56 | 56 | |
| 57 | - if(null!==($this->getArgumentos())){ |
|
| 57 | + if (null !== ($this->getArgumentos())) { |
|
| 58 | 58 | $this->setArgumentos(array()); |
| 59 | 59 | } |
| 60 | 60 | } |
@@ -76,16 +76,16 @@ discard block |
||
| 76 | 76 | |
| 77 | 77 | public function setControlador($controlador) |
| 78 | 78 | { |
| 79 | - return $this->_controlador=$controlador; |
|
| 79 | + return $this->_controlador = $controlador; |
|
| 80 | 80 | } |
| 81 | 81 | |
| 82 | 82 | public function setMetodo($metodo) |
| 83 | 83 | { |
| 84 | - return $this->_metodo=$metodo; |
|
| 84 | + return $this->_metodo = $metodo; |
|
| 85 | 85 | } |
| 86 | 86 | |
| 87 | 87 | public function setArgumentos($argumento) |
| 88 | 88 | { |
| 89 | - return $this->_argumentos=$argumento; |
|
| 89 | + return $this->_argumentos = $argumento; |
|
| 90 | 90 | } |
| 91 | 91 | } |
@@ -10,12 +10,12 @@ discard block |
||
| 10 | 10 | parent::__construct(); |
| 11 | 11 | |
| 12 | 12 | // cargamos la clase ayudantes para usar sus metodos de ayuda |
| 13 | - $this->_ayuda= new Sistema\Ayudantes\CFPHPAyuda; |
|
| 14 | - $this->_seg= new Sistema\Ayudantes\CFPHPSeguridad; |
|
| 15 | - $this->_sesion=new Sistema\Nucleo\CFSesion(); |
|
| 13 | + $this->_ayuda = new Sistema\Ayudantes\CFPHPAyuda; |
|
| 14 | + $this->_seg = new Sistema\Ayudantes\CFPHPSeguridad; |
|
| 15 | + $this->_sesion = new Sistema\Nucleo\CFSesion(); |
|
| 16 | 16 | } |
| 17 | 17 | |
| 18 | - public function index(){ |
|
| 18 | + public function index() { |
|
| 19 | 19 | $this->_sesion->iniciarSesion('_s', Cf_SESION_PARAMETRO_SEGURO); |
| 20 | 20 | session_destroy(); |
| 21 | 21 | $this->_vista->titulo = 'CalimaFramework Login'; |
@@ -23,19 +23,19 @@ discard block |
||
| 23 | 23 | $this->_vista->imprimirVista('index', 'usuario'); |
| 24 | 24 | } |
| 25 | 25 | |
| 26 | - public function registro(){ |
|
| 26 | + public function registro() { |
|
| 27 | 27 | $this->_vista->titulo = 'CalimaFramework registro'; |
| 28 | 28 | $this->_vista->imprimirVista('registro', 'usuario'); |
| 29 | 29 | |
| 30 | 30 | } |
| 31 | 31 | |
| 32 | - public function crearRegistro(){ |
|
| 32 | + public function crearRegistro() { |
|
| 33 | 33 | $datas = $this->cargaModelo('usuario'); |
| 34 | - if(isset($_POST['nombre'])){ |
|
| 35 | - $nombre=$_POST['nombre']; |
|
| 36 | - $email=$_POST['email']; |
|
| 37 | - $usuario=$_POST['nombre']; |
|
| 38 | - $clave=$this->_seg->cifrado($this->_seg->filtrarTexto($_POST['clave'])); |
|
| 34 | + if (isset($_POST['nombre'])) { |
|
| 35 | + $nombre = $_POST['nombre']; |
|
| 36 | + $email = $_POST['email']; |
|
| 37 | + $usuario = $_POST['nombre']; |
|
| 38 | + $clave = $this->_seg->cifrado($this->_seg->filtrarTexto($_POST['clave'])); |
|
| 39 | 39 | |
| 40 | 40 | $datas->insertarRegistro( |
| 41 | 41 | $this->_seg->filtrarTexto($_POST['nombre']), |
@@ -45,24 +45,24 @@ discard block |
||
| 45 | 45 | ); |
| 46 | 46 | $this->_ayuda->redireccionUrl('usuario'); |
| 47 | 47 | } |
| 48 | - else{ |
|
| 48 | + else { |
|
| 49 | 49 | $this->_ayuda->redireccionUrl('usuario/registro'); |
| 50 | 50 | } |
| 51 | 51 | } |
| 52 | 52 | |
| 53 | - public function valida(){ |
|
| 54 | - if(isset($_POST['usuario'])){ |
|
| 55 | - $usuario=$_POST['usuario']; |
|
| 56 | - $clave=$this->_seg->cifrado($this->_seg->filtrarTexto($_POST['clave'])); |
|
| 53 | + public function valida() { |
|
| 54 | + if (isset($_POST['usuario'])) { |
|
| 55 | + $usuario = $_POST['usuario']; |
|
| 56 | + $clave = $this->_seg->cifrado($this->_seg->filtrarTexto($_POST['clave'])); |
|
| 57 | 57 | |
| 58 | 58 | $datosUser = $this->cargaModelo('usuario'); |
| 59 | - $valida=$datosUser->seleccionUsuario($usuario, $clave); |
|
| 59 | + $valida = $datosUser->seleccionUsuario($usuario, $clave); |
|
| 60 | 60 | |
| 61 | - if(isset($valida)){ |
|
| 61 | + if (isset($valida)) { |
|
| 62 | 62 | $this->_sesion->iniciarSesion('_s', Cf_SESION_PARAMETRO_SEGURO); |
| 63 | - $_SESSION['usuario']=$usuario; |
|
| 64 | - $_SESSION['id_usuario']=$valida['id_usuario']; |
|
| 65 | - $_SESSION['nivel']=$valida['nivel']; |
|
| 63 | + $_SESSION['usuario'] = $usuario; |
|
| 64 | + $_SESSION['id_usuario'] = $valida['id_usuario']; |
|
| 65 | + $_SESSION['nivel'] = $valida['nivel']; |
|
| 66 | 66 | $this->_ayuda->redireccionUrl('data/index'); |
| 67 | 67 | } |
| 68 | 68 | $this->_ayuda->redireccionUrl('usuario'); |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | } |
| 71 | 71 | } |
| 72 | 72 | |
| 73 | - public function cerrarSesion(){ |
|
| 73 | + public function cerrarSesion() { |
|
| 74 | 74 | $this->_sesion->iniciarSesion('_s', false); |
| 75 | 75 | session_destroy(); |
| 76 | 76 | $this->_sesion->destruir('usuario'); |
@@ -35,13 +35,13 @@ discard block |
||
| 35 | 35 | $nombre=$_POST['nombre']; |
| 36 | 36 | $email=$_POST['email']; |
| 37 | 37 | $usuario=$_POST['nombre']; |
| 38 | - $clave=$this->_seg->cifrado($this->_seg->filtrarTexto($_POST['clave'])); |
|
| 38 | + $clave=$this->_seg->cifrado($this->_seg->filtrarTexto($_POST['clave'])); |
|
| 39 | 39 | |
| 40 | - $datas->insertarRegistro( |
|
| 41 | - $this->_seg->filtrarTexto($_POST['nombre']), |
|
| 42 | - $this->_seg->filtrarTexto($_POST['email']), |
|
| 43 | - '1', |
|
| 44 | - $clave |
|
| 40 | + $datas->insertarRegistro( |
|
| 41 | + $this->_seg->filtrarTexto($_POST['nombre']), |
|
| 42 | + $this->_seg->filtrarTexto($_POST['email']), |
|
| 43 | + '1', |
|
| 44 | + $clave |
|
| 45 | 45 | ); |
| 46 | 46 | $this->_ayuda->redireccionUrl('usuario'); |
| 47 | 47 | } |
@@ -65,12 +65,12 @@ discard block |
||
| 65 | 65 | $_SESSION['nivel']=$valida['nivel']; |
| 66 | 66 | $this->_ayuda->redireccionUrl('data/index'); |
| 67 | 67 | } |
| 68 | - $this->_ayuda->redireccionUrl('usuario'); |
|
| 68 | + $this->_ayuda->redireccionUrl('usuario'); |
|
| 69 | 69 | |
| 70 | 70 | } |
| 71 | 71 | } |
| 72 | 72 | |
| 73 | - public function cerrarSesion(){ |
|
| 73 | + public function cerrarSesion(){ |
|
| 74 | 74 | $this->_sesion->iniciarSesion('_s', false); |
| 75 | 75 | session_destroy(); |
| 76 | 76 | $this->_sesion->destruir('usuario'); |
@@ -44,8 +44,7 @@ |
||
| 44 | 44 | $clave |
| 45 | 45 | ); |
| 46 | 46 | $this->_ayuda->redireccionUrl('usuario'); |
| 47 | - } |
|
| 48 | - else{ |
|
| 47 | + } else{ |
|
| 49 | 48 | $this->_ayuda->redireccionUrl('usuario/registro'); |
| 50 | 49 | } |
| 51 | 50 | } |