1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* |
4
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
5
|
|
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
6
|
|
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
7
|
|
|
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
8
|
|
|
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
9
|
|
|
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
10
|
|
|
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
11
|
|
|
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
12
|
|
|
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
13
|
|
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
14
|
|
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
15
|
|
|
* |
16
|
|
|
* This software consists of voluntary contributions made by many individuals |
17
|
|
|
* and is licensed under the MIT license. For more information, see |
18
|
|
|
* @category |
19
|
|
|
* @package sistema/ayudantes |
20
|
|
|
* @copyright Copyright (c) 2006 - 2014 webcol.net (http://www.webcol.net/calima) |
21
|
|
|
* @license https://github.com/webcol/Calima/blob/master/LICENSE MIT |
22
|
|
|
* @version ##BETA 1.0##, ##2014 - 2015## |
23
|
|
|
* <http://www.calimaframework.com>. |
24
|
|
|
*/ |
25
|
|
|
|
26
|
|
|
namespace Sistema\Ayudantes; |
27
|
|
|
|
28
|
|
|
|
29
|
|
|
|
30
|
|
|
class CFPHPAyuda { |
31
|
|
|
|
32
|
|
|
|
33
|
|
|
private $_sesion; |
34
|
|
|
//Email |
35
|
|
|
|
36
|
|
|
public function __construct() { |
37
|
|
|
//parent::__construct(); |
38
|
|
|
|
39
|
|
|
$this->_sesion=new \Sistema\Nucleo\CFSesion(); |
40
|
|
|
} |
41
|
|
|
public function enviarCorreo($para, $titulo= 'Asunto', $mensaje= 'cuerpo del correo'){ |
42
|
|
|
return mail($para, $titulo, $mensaje); |
43
|
|
|
} |
44
|
|
|
|
45
|
|
|
|
46
|
|
|
// filtros Email |
47
|
|
|
|
48
|
|
|
function filtroEmail($email){ |
49
|
|
|
if (!filter_input(INPUT_POST, $email, FILTER_VALIDATE_EMAIL)){ |
50
|
|
|
echo "E-Mail no es valido"; |
51
|
|
|
} |
52
|
|
|
else |
53
|
|
|
{ |
54
|
|
|
echo "E-Mail es valido"; |
55
|
|
|
} |
56
|
|
|
|
57
|
|
|
} |
58
|
|
|
|
59
|
|
|
//cadenas |
60
|
|
|
|
61
|
|
|
function rangoTexto($texto, $inicio, $cantidad){ |
62
|
|
|
|
63
|
|
|
return $limite= substr($texto, $inicio, $cantidad); |
64
|
|
|
|
65
|
|
|
} |
66
|
|
|
|
67
|
|
|
//Redirecionar |
68
|
|
|
|
69
|
|
|
function Redireccion($url, $permanent = false){ |
70
|
|
|
header('Location: ' . $url, true, $permanent ? 301 : 302); |
71
|
|
|
|
72
|
|
|
exit(); |
|
|
|
|
73
|
|
|
} |
74
|
|
|
|
75
|
|
|
function redireccionUrl($url){ |
76
|
|
|
$url=Cf_BASE_URL.$url; |
77
|
|
|
header('Location: ' . $url); |
78
|
|
|
exit(); |
|
|
|
|
79
|
|
|
} |
80
|
|
|
|
81
|
|
|
function redireccionUrlMsj($controlador){ |
|
|
|
|
82
|
|
|
$this->_sesion->iniciarSesion('_s', false); |
83
|
|
|
$_SESSION[error_ingreso]='Error en el intento de ingreso'; |
84
|
|
|
$controlador=Cf_BASE_URL.$controlador; |
85
|
|
|
header('Location: ' . $controlador); |
86
|
|
|
exit(); |
|
|
|
|
87
|
|
|
} |
88
|
|
|
|
89
|
|
|
function redireccion_($url, $statusCode = 303){ |
90
|
|
|
header('Location: ' . $url, true, $statusCode); |
91
|
|
|
die(); |
|
|
|
|
92
|
|
|
} |
93
|
|
|
|
94
|
|
|
function redirect($controller,$method = "index",$args = array()) |
95
|
|
|
{ |
96
|
|
|
global $core; /* Guess Obviously */ |
|
|
|
|
97
|
|
|
|
98
|
|
|
$location = $core->Cf_BASE_URL . "/" . $controller . "/" . $method . "/" . implode("/",$args); |
99
|
|
|
|
100
|
|
|
/* |
101
|
|
|
* Use @header to redirect the page: |
102
|
|
|
*/ |
103
|
|
|
header("Location: " . $location); |
104
|
|
|
exit; |
|
|
|
|
105
|
|
|
} |
106
|
|
|
|
107
|
|
|
|
108
|
|
|
|
109
|
|
|
//texto |
110
|
|
|
public function filtrarEntero($int){ |
111
|
|
|
|
112
|
|
|
return filter_var($int, FILTER_VALIDATE_INT); |
113
|
|
|
|
114
|
|
|
} |
115
|
|
|
|
116
|
|
|
|
117
|
|
|
} |
118
|
|
|
|
An exit expression should only be used in rare cases. For example, if you write a short command line script.
In most cases however, using an
exit
expression makes the code untestable and often causes incompatibilities with other libraries. Thus, unless you are absolutely sure it is required here, we recommend to refactor your code to avoid its usage.