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 root |
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
|
|
|
require_once __DIR__.'/vendor/autoload.php'; |
27
|
|
|
|
28
|
|
|
use Sistema\Nucleo; |
29
|
|
|
use Sistema\Ayudantes; |
30
|
|
|
//use mvc\controladores; |
31
|
|
|
|
32
|
|
|
//lenguaje |
33
|
|
|
|
34
|
|
|
/*session_start(); |
35
|
|
|
$sesion=new Sistema\Nucleo\CFSesion(); |
36
|
|
|
$sesion->iniciarSesion('_s', false); |
37
|
|
|
header('Cache-control: private'); // IE 6 FIX |
38
|
|
|
*/ |
39
|
|
|
|
40
|
|
|
|
41
|
|
|
|
42
|
|
|
/** Cf directorio separador */ |
43
|
|
|
defined('DS') ? null : define('DS', DIRECTORY_SEPARATOR); |
44
|
|
|
/** Cf raiz del sitio */ |
45
|
|
|
defined('SITE_ROOT')? null: define('SITE_ROOT', realpath(dirname(__FILE__)).DS); |
46
|
|
|
/** Cf PATH del sitio */ |
47
|
|
|
defined('SITE_PATH') ? NULL : define ('SITE_PATH', realpath(dirname(__FILE__) . DS . '..' . DS) . DS); |
48
|
|
|
|
49
|
|
|
/** Cf definimos constante Ruta directa al nucleo de framework */ |
50
|
|
|
define('RUTA_NUCLEO', SITE_ROOT . 'Sistema'.DS.'Nucleo' . DS); |
51
|
|
|
|
52
|
|
|
# define para mvc erp |
53
|
|
|
|
54
|
|
|
/** Cf definimos constante directa a la vista del framework */ |
55
|
|
|
define('VIEW_PATH', SITE_ROOT . 'mvc'.DS.'vistas' . DS); |
56
|
|
|
/** Cf definimos constante directa a los controladores del framework */ |
57
|
|
|
define('CONTR_PATH', SITE_ROOT . 'mvc'.DS.'controladores' . DS); |
58
|
|
|
/** Cf definimos constante directa a los modelos del framework */ |
59
|
|
|
define('RUTA_MOD', SITE_ROOT . 'mvc'.DS.'modelos' . DS); |
60
|
|
|
|
61
|
|
|
# define ruta a los stilos del public |
62
|
|
|
|
63
|
|
|
/** Cf definimos constante directa a los css dentro del directorio public_ del framework */ |
64
|
|
|
define('CSS_PATH', SITE_ROOT . 'public_'.DS.'css' . DS); |
65
|
|
|
/** Cf definimos constante directa a los css dentro del directorio public_ del framework */ |
66
|
|
|
define('IMG_PATH', SITE_ROOT . 'public_'.DS.'img' . DS); |
67
|
|
|
/** Cf definimos constante directa a los js dentro del directorio public_ del framework */ |
68
|
|
|
define('JS_PATH', SITE_ROOT . 'public_'.DS.'js' . DS); |
69
|
|
|
/** Cf definimos constante directa a las librerias dentro del framework */ |
70
|
|
|
define('RUTA_LIBS', SITE_ROOT . 'Sistema'.DS.'librerias' . DS); |
71
|
|
|
/** Cf definimos constante directa a los ayudantes del framework */ |
72
|
|
|
define('RUTA_AYUDANTES', SITE_ROOT . 'Sistema'.DS.'ayudantes' . DS); |
73
|
|
|
|
74
|
|
|
/** Cf definimos constante directa a los lenguajes del framework */ |
75
|
|
|
define('RUTA_LENGUAJES', SITE_ROOT . 'Sistema'.DS.'lenguajes' . DS); |
76
|
|
|
|
77
|
|
|
|
78
|
|
|
//LENGUAJES |
79
|
|
|
//En el directorio sistema lenguajes hay varios archivos php cada uno para crear las constantes en el idioma especifico |
80
|
|
|
//luego por get capturamos la variable lan al inicio de la aplicacion asi: www.tuapp.com/?lang=de |
81
|
|
|
|
82
|
|
|
$lang = 'es'; // por defecto el idioma para el app es español puede ser en, bt, de, zh |
83
|
|
|
if(isSet($_GET['lang'])){ |
84
|
|
|
$lang = $_GET['lang']; |
85
|
|
|
} |
86
|
|
|
//en caso de no cumplir la condicion el $lang va ser "es" |
87
|
|
|
|
88
|
|
|
//valido que no este creada la sesion ò cookie de lang |
89
|
|
|
if(!isSet($_SESSION['lang']) || !isSet($_COOKIE['lang'])){ |
90
|
|
|
// register the session and set the cookie |
91
|
|
|
$_SESSION['lang'] = $lang; |
92
|
|
|
setcookie('lang', $lang, time() + (3600 * 24 * 30)); |
93
|
|
|
} |
94
|
|
|
|
95
|
|
|
$lang_file = 'lang.'.$lang.'.php'; |
96
|
|
|
|
97
|
|
|
include_once RUTA_LENGUAJES . $lang_file; |
98
|
|
|
|
99
|
|
|
//FIN LENGUAJES |
100
|
|
|
|
101
|
|
|
|
102
|
|
|
|
103
|
|
|
#Firewall desactivado |
104
|
|
|
|
105
|
|
|
/*define('PHP_FIREWALL_REQUEST_URI', strip_tags( $_SERVER['REQUEST_URI'] ) ); |
106
|
|
|
define('PHP_FIREWALL_ACTIVATION', true ); |
107
|
|
|
if ( is_file( @dirname(__FILE__).'RUTA_LIBS'.DS.'php-firewall'.DS.'firewall.php' ) ) |
108
|
|
|
include_once( @dirname(__FILE__).'RUTA_LIBS'.DS.'php-firewall'.DS.'firewall.php' );*/ |
109
|
|
|
|
110
|
|
|
# Cargamos la autocarga dinamica y configuraciones |
111
|
|
|
//require_once RUTA_NUCLEO . 'Cf_Autocarga.php'; |
112
|
|
|
require_once RUTA_NUCLEO . 'CFConfiguracion.php'; |
113
|
|
|
|
114
|
|
|
try{ |
115
|
|
|
|
116
|
|
|
Nucleo\CFBootstrap::actuar(new Nucleo\CFSolicitud); |
117
|
|
|
//CFBootstrap::actuar(new CFSolicitud); |
118
|
|
|
|
119
|
|
|
} catch (Exception $e) { |
120
|
|
|
echo $e->getMessage(); |
121
|
|
|
} |
122
|
|
|
|
123
|
|
|
/*try{ |
124
|
|
|
CfBootstrap::actuar(new Cf_Solicitud); |
125
|
|
|
} |
126
|
|
|
catch(Exception $e){ |
127
|
|
|
|
128
|
|
|
}*/ |
129
|
|
|
|
The PSR-1: Basic Coding Standard recommends that a file should either introduce new symbols, that is classes, functions, constants or similar, or have side effects. Side effects are anything that executes logic, like for example printing output, changing ini settings or writing to a file.
The idea behind this recommendation is that merely auto-loading a class should not change the state of an application. It also promotes a cleaner style of programming and makes your code less prone to errors, because the logic is not spread out all over the place.
To learn more about the PSR-1, please see the PHP-FIG site on the PSR-1.