public static function validatCreate($nombre, $apellidos, $cedula, $direccion, $telefono)
 {
     $flag = FALSE;
     $patron = "^[a-zA-Z0-9]{3,20}\$";
     if (!ereg($patron, $nombre)) {
         session::getInstance()->setError('campo nombre no permite carateres especiales');
         $flag = true;
         session::getInstance()->setFirstCall(datosUsuarioTableClass::getNameField(datosUsuarioTableClass::NOMBRE, true), true);
     }
     if ($flag == true) {
         request::getInstance()->setMethod('GET');
         routing::getInstance()->forward('datos', 'insert');
     }
     if (!ereg($patron, $apellidos)) {
         session::getInstance()->setError('campo apellidos no permite carateres especiales');
         $flag = true;
         session::getInstance()->setFirstCall(datosUsuarioTableClass::getNameField(datosUsuarioTableClass::APELLIDOS, true), true);
     }
     if (!ereg($patron, $cedula)) {
         session::getInstance()->setError('campo cedula no permite carateres especiales');
         $flag = true;
         session::getInstance()->setFirstCall(datosUsuarioTableClass::getNameField(datosUsuarioTableClass::CEDULA, true), true);
     }
     if (!ereg($patron, $direccion)) {
         session::getInstance()->setError('campo direccion no permite carateres especiales');
         $flag = true;
         session::getInstance()->setFirstCall(datosUsuarioTableClass::getNameField(datosUsuarioTableClass::DIRECCION, true), true);
     }
     if (!ereg($patron, $telefono)) {
         session::getInstance()->setError('campo telefono no permite carateres especiales');
         $flag = true;
         session::getInstance()->setFirstCall(datosUsuarioTableClass::getNameField(datosUsuarioTableClass::TELEFONO, true), true);
     }
 }
 public function execute()
 {
     try {
         $fields = array(loteTableClass::ID, loteTableClass::NOMBRE);
         $orderBy = array(loteTableClass::ID);
         $page = 0;
         if (request::getInstance()->hasGet('page')) {
             $page = request::getInstance()->getGet('page') - 1;
             $page = $page * config::getRowGrid();
         }
         $f = array(loteTableClass::ID);
         if (request::getInstance()->hasGet('page')) {
             $this->page = request::getInstance()->getGet('page');
         } else {
             $this->page = $page;
         }
         $lines = config::getRowGrid();
         $this->cntPages = loteTableClass::getAllCount($f, true, $lines);
         //$this->page = request::getInstance()->getGet('page');
         $this->objLote = loteTableClass::getAll($fields, true, $orderBy, 'ASC', config::getRowGrid(), $page);
         $this->defineView('index', 'lote', session::getInstance()->getFormatOutput());
     } catch (PDOException $exc) {
         session::getInstance()->setFlash('exc', $exc);
         routing::getInstance()->forward('shfSecurity', 'exception');
     }
 }
 public function execute()
 {
     try {
         $this->defineView('insert', 'vacuna', session::getInstance()->getFormatOutput());
     } catch (PDOException $exc) {
         session::getInstance()->setFlash('exc', $exc);
         routing::getInstance()->forward('shfSecurity', 'exception');
     }
 }
 public function execute()
 {
     try {
         $fieldsEmpleado = array(empleadoTableClass::ID, empleadoTableClass::NUMERO_DOC);
         $this->objEmpleado = empleadoTableClass::getAll($fieldsEmpleado, true);
         $this->defineView('insert', 'pago', session::getInstance()->getFormatOutput());
     } catch (PDOException $exc) {
         session::getInstance()->setFlash('exc', $exc);
         routing::getInstance()->forward('shfSecurity', 'exception');
     }
 }
 public function execute()
 {
     try {
         $fieldsTipo_doc = array(tipoDocumentoTableClass::ID, tipoDocumentoTableClass::DESCRIPCION);
         $fieldsCiudad = array(ciudadTableClass::ID, ciudadTableClass::NOMBRE);
         $this->objCiudad = ciudadTableClass::getAll($fieldsCiudad, true);
         $this->objTipo_doc = tipoDocumentoTableClass::getAll($fieldsTipo_doc, true);
         $this->defineView('insert', 'cliente', session::getInstance()->getFormatOutput());
     } catch (PDOException $exc) {
         session::getInstance()->setFlash('exc', $exc);
         routing::getInstance()->forward('shfSecurity', 'exception');
     }
 }
 public static function validateCreate($descripcion)
 {
     $flag = false;
     $patternC = "^[a-zA-Z0-9]{3,20}\$";
     if (ereg($patternC, $descripcion) == false) {
         session::getInstance()->setError('nop');
         $flag = true;
         session::getInstance()->setFlash(cargoTableClass::getNameField(cargoTableClass::DESCRIPCION, true), true);
     }
     if ($flag == true) {
         request::getInstance()->setMethod('GET');
         routing::getInstance()->forward('personal', 'insertCargo');
     }
 }
 public function execute()
 {
     try {
         if (request::getInstance()->isMethod('POST') === true) {
             $language = request::getInstance()->getPost('language');
             $PATH_INFO = request::getInstance()->getPost('PATH_INFO');
             session::getInstance()->setDefaultCulture($language);
             $dir = config::getUrlBase() . config::getIndexFile() . $PATH_INFO;
             header('Location: ' . $dir);
         } else {
             routing::getInstance()->redirect('shfSecurity', 'login');
         }
         //close if
     } catch (PDOException $exc) {
         echo $exc->getMessage();
         echo '<br>';
         echo '<pre>';
         print_r($exc->getTrace());
         echo '</pre>';
     }
 }
 public static function validateCreate($animal, $valor)
 {
     $flag = false;
     if (empty($animal) or !isset($animal) or $animal == '') {
         session::getInstance()->setError(i18n::__(10093, null, 'errors'));
         $flag = true;
         session::getInstance()->setFlash(detalleProcesoVentaTableClassgetNameField(detalleProcesoVentaTableClass::ANIMAL, true), true);
     }
     if (!is_numeric($animal)) {
         session::getInstance()->setError(i18n::__(10057, null, 'errors'));
         $flag = true;
         session::getInstance()->setFlash(detalleProcesoVentaTableClass::getNameField(detalleProcesoVentaTableClass::ANIMAL, true), true);
     }
     if ($animal < 0) {
         session::getInstance()->setError(i18n::__(10095, null, 'errors'));
         $flag = true;
         session::getInstance()->setFlash(detalleProcesoVentaTableClass::getNameField(detalleProcesoVentaTableClass::ANIMAL, true), true);
     }
     if ($valor < 0) {
         session::getInstance()->setError(i18n::__(10116, null, 'errors'));
         $flag = true;
         session::getInstance()->setFlash(detalleProcesoVentaTableClass::getNameField(detalleProcesoVentaTableClass::VALOR, true), true);
     }
     if (empty($valor) or !isset($valor) or $valor == '') {
         session::getInstance()->setError(i18n::__(10117, null, 'errors'));
         $flag = true;
         session::getInstance()->setFlash(detalleProcesoVentaTableClass::getNameField(detalleProcesoVentaTableClass::VALOR, true), true);
     }
     if (!is_numeric($valor)) {
         session::getInstance()->setError(i18n::__(10118, null, 'errors'));
         $flag = true;
         session::getInstance()->setFlash(detalleProcesoVentaTableClass::getNameField(detalleProcesoVentaTableClass::VALOR, true), true);
     }
     if ($flag == true) {
         request::getInstance()->setMethod('GET');
         routing::getInstance()->forward('factura', 'indexFacturaVenta');
     }
 }
Example #9
0
define('APPLICATION_PATH', realpath(dirname(__FILE__)));
function includeCore($class)
{
    if (file_exists("core/" . $class . ".class.php")) {
        include "core/" . $class . ".class.php";
    }
}
function includeModel($class)
{
    if (file_exists("models/" . $class . ".class.php")) {
        include "models/" . $class . ".class.php";
    }
}
spl_autoload_register("includeCore");
spl_autoload_register("includeModel");
$route = routing::getRouting();
$name_controller = $route["c"] . "Controller";
$path_controller = "controllers/" . $name_controller . ".class.php";
try {
    if (file_exists($path_controller)) {
        include $path_controller;
        $c = new $name_controller();
        //Vérifier que dans ma class il y ai une méthode
        //du nom de $action
        $name_action = $route["a"] . "Action";
        if (method_exists($c, $name_action)) {
            $c->{$name_action}($route["args"]);
        } else {
            throw new Exception("L'action n'existe pas.");
        }
    } else {
 public static function validateCreate($insumo, $cantidad, $valor, $tipo)
 {
     $flag = false;
     if (empty($id_registro) or !isset($id_registro) or $id_registro == '') {
         session::getInstance()->setError(i18n::__(10107, null, 'errors'));
         $flag = true;
         session::getInstance()->setFlash(detalleProcesoCompraTableClassgetNameField(detalleProcesoCompraTableClass::PROCESO_COMPRA_ID, true), true);
     }
     if (!is_numeric($id_registro)) {
         session::getInstance()->setError(i18n::__(10108, null, 'errors'));
         $flag = true;
         session::getInstance()->setFlash(detalleProcesoCompraTableClass::getNameField(detalleProcesoCompraTableClass::PROCESO_COMPRA_ID, true), true);
     }
     if ($id_registro < 0) {
         session::getInstance()->setError(i18n::__(10109, null, 'errors'));
         $flag = true;
         session::getInstance()->setFlash(detalleProcesoCompraTableClass::getNameField(detalleProcesoCompraTableClass::PROCESO_COMPRA_ID, true), true);
     }
     if (empty($tipo) or !isset($tipo) or $tipo == '') {
         session::getInstance()->setError(i18n::__(10044, null, 'errors'));
         $flag = true;
         session::getInstance()->setFlash(detalleProcesoCompraTableClass::getNameField(detalleProcesoCompraTableClass::TIPO_INSUMO, true), true);
     }
     if (!is_numeric($tipo)) {
         session::getInstance()->setError(i18n::__(10085, null, 'errors'));
         $flag = true;
         session::getInstance()->setFlash(detalleProcesoCompraTableClass::getNameField(detalleProcesoCompraTableClass::TIPO_INSUMO, true), true);
     }
     if ($tipo < 0) {
         session::getInstance()->setError(i18n::__(10086, null, 'errors'));
         $flag = true;
         session::getInstance()->setFlash(detalleProcesoCompraTableClass::getNameField(detalleProcesoCompraTableClass::TIPO_INSUMO, true), true);
     }
     if (empty($insumo) or !isset($insumo) or $insumo == '') {
         session::getInstance()->setError(i18n::__(10047, null, 'errors'));
         $flag = true;
         session::getInstance()->setFlash(detalleProcesoCompraTableClass::getNameField(detalleProcesoCompraTableClass::INSUMO_ID, true), true);
     }
     if (!is_numeric($insumo)) {
         session::getInstance()->setError(i18n::__(10102, null, 'errors'));
         $flag = true;
         session::getInstance()->setFlash(detalleProcesoCompraTableClass::getNameField(detalleProcesoCompraTableClass::INSUMO_ID, true), true);
     }
     if ($insumo < 0) {
         session::getInstance()->setError(i18n::__(10103, null, 'errors'));
         $flag = true;
         session::getInstance()->setFlash(detalleProcesoCompraTableClass::getNameField(detalleProcesoCompraTableClass::INSUMO_ID, true), true);
     }
     if ($valor < 0) {
         session::getInstance()->setError(i18n::__(10080, null, 'errors'));
         $flag = true;
         session::getInstance()->setFlash(detalleProcesoCompraTableClass::getNameField(detalleProcesoCompraTableClass::VALOR_UNITARIO, true), true);
     }
     if (empty($valor) or !isset($valor) or $valor == '') {
         session::getInstance()->setError(i18n::__(10050, null, 'errors'));
         $flag = true;
         session::getInstance()->setFlash(detalleProcesoCompraTableClass::getNameField(detalleProcesoCompraTableClass::VALOR_UNITARIO, true), true);
     }
     if (!is_numeric($valor)) {
         session::getInstance()->setError(i18n::__(10051, null, 'errors'));
         $flag = true;
         session::getInstance()->setFlash(detalleProcesoCompraTableClass::getNameField(detalleProcesoCompraTableClass::VALOR_UNITARIO, true), true);
     }
     if (empty($cantidad) or !isset($cantidad) or $cantidad == '') {
         session::getInstance()->setError(i18n::__(10087, null, 'errors'));
         $flag = true;
         session::getInstance()->setFlash(detalleProcesoCompraTableClass::getNameField(detalleProcesoCompraTableClass::CANTIDAD, true), true);
     }
     if (!is_numeric($cantidad)) {
         session::getInstance()->setError(i18n::__(10083, null, 'errors'));
         $flag = true;
         session::getInstance()->setFlash(detalleProcesoCompraTableClass::getNameField(detalleProcesoCompraTableClass::CANTIDAD, true), true);
     }
     if ($cantidad < 0) {
         session::getInstance()->setError(i18n::__(10081, null, 'errors'));
         $flag = true;
         session::getInstance()->setFlash(detalleProcesoCompraTableClass::getNameField(detalleProcesoCompraTableClass::CANTIDAD, true), true);
     }
     if ($flag == true) {
         request::getInstance()->setMethod('GET');
         routing::getInstance()->forward('factura', 'indexFacturaCompra');
     }
 }
<?php

require_once "global.php";
setlocale(LC_ALL, SYSTEM_LOCALE);
date_default_timezone_set(SYSTEM_TIMEZONE);
ini_set('max_execution_time', 1200);
// remove for live version
ini_set('xdebug.max_nesting_level', '100000');
ini_set('display_errors', 'on');
session_start();
require_once "application/routing.php";
routing::process();
}
if ($result = $session->mysqli->query($sql)) {
    while ($row = $result->fetch_object()) {
        $events[] = $row;
    }
}
?>
<div class="show_tooltip">
	<ul>
	<?php 
if (count($events) > 0) {
    foreach ($events as $event) {
        ?>
            <li>
                <h3><a href="<?php 
        echo routing::short('show.php?id=' . $event->show_id);
        ?>
"><?php 
        echo $event->title;
        ?>
</a></h3>
            <h4 class="date_time"><?php 
        echo $event->e_time;
        ?>
, <?php 
        echo $event->show_venue;
        ?>
</h4>


            <br style="clear:both" />
Example #13
0
// Load validation functions.
// Load configuration files.
require_once root_directory . blastpad_path . "/common/global_variable.php";
// Load the global variables.
require_once root_directory . custom_folder . "/config.php";
// Load configuration.
require_file(custom_folder . "/customize.php");
// Load customization file.
require_file(custom_folder . "/config/database/config_" . $server_environment . ".php");
// Load database configuration details.
require_once root_directory . custom_folder . "/config/route/config_route.php";
// Load route configuration file.
$database = new database($database_connection, $server_environment);
/* If connection to database fails, go to installation script to create database tables and properly configure database.  
header( "Location: welcome.php" );
exit;*/
$site_builder = new site_builder();
$site = $site_builder->get_site();
$routing = new routing();
$routing->set($route);
// Set errors.
// ini_set( "error_reporting", $config[ $server_environment ][ "error_reporting" ] );
/*	
	function set_assert(){
		assert_options( ASSERT_ACTIVE,   true );
		assert_options( ASSERT_BAIL,     true );
		assert_options( ASSERT_WARNING,  false );
		assert_options( ASSERT_CALLBACK, "assert_failure" );
		assert_options( ASSERT_QUIET_EVAL, true );
	}
*/
Example #14
0
define('BUILD_ROOT', FS_ROOT . trim(BASE_URL, DS));
/* The full path we'll be using in the URI */
define('APP_BUILD_ROOT', FS_ROOT . trim(BASE_URL . DS, DS) . DS . trim(APP_ROOT, DS));
/* If you need to call something from the root of your appliction space */
function root()
{
    return rtrim(ROOT . trim(BASE_URL, DS), DS) . DS;
}
function assets()
{
    return root() . 'assets/';
}
/* Create a routing object and pass it our URI so we can get the controller
 * action, and paramaters passed in our URI
 */
$routing = new routing(APP_BUILD_ROOT);
$route = $routing->breakURI($_SERVER['REQUEST_URI'], BUILD_URI);
define('REQUEST', $routing->request);
function self()
{
    return root() . trim(REQUEST, DS);
}
$controller = $routing->getControllerName();
$action = $routing->getActionName();
$paramaters = $routing->getParamaters();
/* Instantiate our crumbMVC controller */
$crumb_mvc = new crumbMVC(true, true, true);
try {
    /* First check to see if our URI points to a support resource (not a php
     * file)
     */
 public static function process()
 {
     if (array_key_exists('c', $_GET)) {
         $controller_name = $_GET['c'];
     }
     if (array_key_exists('a', $_GET)) {
         $action_name = $_GET['a'];
     }
     if (array_key_exists('v', $_GET)) {
         $value = $_GET['v'];
     }
     if (array_key_exists('sv', $_GET)) {
         $sub_value = $_GET['sv'];
     }
     // set default values
     if (!isset($controller_name)) {
         $controller_name = 'home';
     }
     if (!isset($action_name)) {
         $action_name = 'index';
     }
     if (!isset($value)) {
         $value = '';
     }
     if (!isset($sub_value)) {
         $sub_value = '';
     }
     $verb = strtoupper($_SERVER['REQUEST_METHOD']);
     $query_string_array = array();
     if (array_key_exists('QUERY_STRING', $_SERVER)) {
         parse_str($_SERVER['QUERY_STRING'], $query_string_array);
     }
     $session_service = service_factory::get_session_service();
     $session_service->set();
     $session_service->extend();
     switch ($controller_name) {
         case 'home':
             global $model;
             $controller = controller_factory::get_home_controller();
             $model = $controller->index();
             break;
         case 'account':
             global $model;
             $controller = controller_factory::get_account_controller();
             switch ($action_name) {
                 case 'signup':
                     if ($verb === 'POST') {
                         $model = $controller->do_signup($_POST['first-name'], $_POST['last-name'], $_POST['username'], $_POST['password']);
                     } else {
                         $model = $controller->show_signup();
                     }
                     break;
                 case 'signin':
                     if ($verb === 'POST') {
                         $model = $controller->do_signin($_POST['account-username'], $_POST['account-password']);
                         if ($model->success) {
                             dispatcher::redirect('/');
                         }
                     } else {
                         $url = '';
                         if (array_key_exists('url', $query_string_array)) {
                             $url = $query_string_array['url'];
                         }
                         $model = $controller->show_signin($url);
                     }
                     break;
                 case 'signout':
                     $controller->signout();
                     dispatcher::redirect('/');
                     break;
             }
             break;
         case 'location':
             global $session;
             $controller = controller_factory::get_list_controller();
             switch ($action_name) {
                 case 'index':
                     if ($session) {
                         $data = $controller->get_locations($session->user_id);
                         dispatcher::dispatch(200, json_encode($data), 'application/json');
                     } else {
                         dispatcher::dispatch_error(401);
                     }
                     break;
                 case 'tracking':
                     if ($session) {
                         $data = $controller->get_trackings_by_location($value, $session->user_id);
                         dispatcher::dispatch(200, json_encode($data), 'application/json');
                     } else {
                         dispatcher::dispatch_error(401);
                     }
                     break;
                 case 'checkin':
                     $data = $controller->get_trackings_by_location($value, 0);
                     dispatcher::dispatch(200, count($data), 'application/json');
                     break;
                 case 'report':
                     if ($session) {
                         $data = $controller->get_location_report_by_date($value);
                         dispatcher::dispatch(200, json_encode($data), 'application/json');
                     } else {
                         dispatcher::dispatch_error(401);
                     }
                     break;
                 case 'status':
                     if ($session) {
                         $data = $controller->get_tracking_status($value, $session->user_id);
                         dispatcher::dispatch(200, json_encode($data), 'application/json');
                     } else {
                         dispatcher::dispatch_error(401);
                     }
                     break;
                 case 'join':
                     if ($verb === 'POST') {
                         if ($session) {
                             $data = $controller->join_location($value, $session->user_id);
                             dispatcher::dispatch(200, json_encode($data), 'application/json');
                         } else {
                             dispatcher::dispatch_error(401);
                         }
                     }
                     break;
                 case 'approve':
                     if ($verb === 'POST') {
                         if ($session) {
                             $data = $controller->approve_user_at_location($value, $sub_value);
                             dispatcher::dispatch(200, json_encode($data), 'application/json');
                         } else {
                             dispatcher::dispatch_error(401);
                         }
                     }
                     break;
                 case 'deactivate':
                     if ($verb === 'POST') {
                         if ($session) {
                             $data = $controller->deactivate_user_at_location($value, $sub_value);
                             dispatcher::dispatch(200, json_encode($data), 'application/json');
                         } else {
                             dispatcher::dispatch_error(401);
                         }
                     }
                     break;
                 case 'reactivate':
                     if ($verb === 'POST') {
                         if ($session) {
                             $data = $controller->reactivate_user_at_location($value, $sub_value);
                             dispatcher::dispatch(200, json_encode($data), 'application/json');
                         } else {
                             dispatcher::dispatch_error(401);
                         }
                     }
                     break;
                 case 'show':
                     if ($session) {
                         $data = $controller->get_location($value, $session->user_id);
                         dispatcher::dispatch(200, json_encode($data), 'application/json');
                     } else {
                         dispatcher::dispatch_error(401);
                     }
                     break;
                 case 'member':
                     if ($session) {
                         $data = $controller->get_members($value);
                         dispatcher::dispatch(200, json_encode($data), 'application/json');
                     } else {
                         dispatcher::dispatch_error(401);
                     }
                     break;
                 default:
                     // do nothing
             }
             break;
         case 'list':
             global $model;
             global $session;
             if ($session) {
                 $controller = controller_factory::get_list_controller();
                 $model = $controller->index();
             } else {
                 dispatcher::dispatch_error(401);
             }
             break;
         case 'tracking':
             if ($verb === 'POST') {
                 global $session;
                 if ($session) {
                     $controller = controller_factory::get_list_controller();
                     $post_data = routing::parse_post_data();
                     if ($action_name === 'checkin') {
                         $data = $controller->check_in($post_data->location_id, $session->user_id);
                         dispatcher::dispatch(200, json_encode($data), 'application/json');
                     } else {
                         if ($action_name === 'checkout') {
                             $data = $controller->check_out($post_data->location_id, $session->user_id);
                             dispatcher::dispatch(200, json_encode($data), 'application/json');
                         }
                     }
                 } else {
                     dispatcher::dispatch_error(401);
                 }
             }
             break;
         default:
             // do nothing
     }
     // fallback
     if (dispatcher::load_view($controller_name, $action_name)) {
         exit;
     } else {
         // error
         dispatcher::dispatch_error(404);
     }
 }