Example #1
1
 /**
  * Cleans up our $_POST superglobal values by performing some basic
  * validation checks on each input, clearing the global and re-assigning
  * it to the scope of our class
  */
 private function sanitizePostFields()
 {
     if (isset($_POST)) {
         # Filter all $_POST values as strings
         $this->post = filter_input_array(INPUT_POST, FILTER_SANITIZE_STRING);
         # Check if the query_string was set and is not empty during POST
         if (isset($this->post["query_string"]) && !empty(trim($this->post["query_string"]))) {
             # encode any special characters
             $query_string = htmlspecialchars($this->post["query_string"]);
             # remove any html tags
             $query_string = strip_tags($query_string);
             # replace any non-alpha characters
             $query_string = preg_replace('/[^\\p{L}\\p{N}\\s]/u', '', $query_string);
             # reassign our query string to our own $post now that we've
             # cleaned it
             $this->post["query_string"] = $query_string;
             # mark this task as done
             $this->status = "OK";
         }
         # Check if the ref value was passed from our form and is not blank
         # as we'll use this later as a session identifier
         if ($this->status == "OK" && isset($this->post["ref"]) && !empty(trim($this->post["ref"]))) {
             # Filter the ref value as an integer for convinience
             $ref = filter_input(INPUT_POST, 'ref', FILTER_SANITIZE_NUMBER_INT);
             # assign our ref to our property
             $this->post["ref"] = $ref;
             # mark this task as done
             $this->status = "OK";
         }
     }
 }
Example #2
0
/**
 * Save keychain details
 */
function orbis_save_keychain_details($post_id, $post)
{
    // Doing autosave
    if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {
        return;
    }
    // Verify nonce
    $nonce = filter_input(INPUT_POST, 'orbis_keychain_details_meta_box_nonce', FILTER_SANITIZE_STRING);
    if (!wp_verify_nonce($nonce, 'orbis_save_keychain_details')) {
        return;
    }
    // Check permissions
    if (!($post->post_type == 'orbis_keychain' && current_user_can('edit_post', $post_id))) {
        return;
    }
    // OK
    $definition = array('_orbis_keychain_url' => FILTER_VALIDATE_URL, '_orbis_keychain_email' => FILTER_VALIDATE_EMAIL, '_orbis_keychain_username' => FILTER_SANITIZE_STRING, '_orbis_keychain_password' => FILTER_UNSAFE_RAW);
    $data = wp_slash(filter_input_array(INPUT_POST, $definition));
    // Pasword
    $password_old = get_post_meta($post_id, '_orbis_keychain_password', true);
    $password_new = $data['_orbis_keychain_password'];
    foreach ($data as $key => $value) {
        if (empty($value)) {
            delete_post_meta($post_id, $key);
        } else {
            update_post_meta($post_id, $key, $value);
        }
    }
    // Action
    if ($post->post_status == 'publish' && !empty($password_old) && $password_old != $password_new) {
        // @see https://github.com/woothemes/woocommerce/blob/v2.1.4/includes/class-wc-order.php#L1274
        do_action('orbis_keychain_password_update', $post_id, $password_old, $password_new);
    }
}
 private function saveProcess()
 {
     if ($_SERVER['REQUEST_METHOD'] != 'POST') {
         View::setMessageFlash("danger", "Form tidak valid");
         return FALSE;
     }
     // form validation
     if (!filter_input(INPUT_POST, "form_token") || Form::isFormTokenValid(filter_input(INPUT_POST, "form_token"))) {
         View::setMessageFlash("danger", "Form tidak valid");
         return FALSE;
     }
     // required fields
     $filter = array("name" => FILTER_SANITIZE_STRING, "phone" => FILTER_SANITIZE_STRING, "address" => FILTER_SANITIZE_STRING);
     $input = filter_input_array(INPUT_POST, $filter);
     if (in_array('', $input) || in_array(NULL, $input)) {
         View::setMessageFlash("danger", "Kolom tidak boleh kosong");
         return FALSE;
     }
     // set member object
     $staff = Authentication::getUser();
     $staff->setData('name', $input['name']);
     $staff->setData('phone', $input['phone']);
     $staff->setData('address', $input['address']);
     if (!($update = $staff->update())) {
         View::setMessageFlash("danger", "Penyimpanan Gagal");
         return;
     }
     View::setMessageFlash("success", "Penyimpanan Berhasil");
 }
Example #4
0
 public function __construct()
 {
     parent::__construct();
     //Session Enabled
     $this->checkLogin();
     //Session Disabled
     //define input filters
     $filterArgs = array('exec' => array('filter' => FILTER_SANITIZE_STRING, 'flags' => FILTER_FLAG_STRIP_LOW | FILTER_FLAG_STRIP_HIGH), 'key' => array('filter' => FILTER_SANITIZE_STRING, 'flags' => FILTER_FLAG_STRIP_LOW | FILTER_FLAG_STRIP_HIGH), 'description' => array('filter' => FILTER_SANITIZE_STRING, 'flags' => FILTER_FLAG_STRIP_LOW | FILTER_FLAG_STRIP_HIGH));
     //filter input
     $_postInput = filter_input_array(INPUT_POST, $filterArgs);
     //assign variables
     $this->exec = $_postInput['exec'];
     $this->key = $_postInput['key'];
     $this->description = $_postInput['description'];
     //check for eventual errors on the input passed
     $this->result['errors'] = array();
     if (empty($this->key)) {
         $this->result['errors'][] = array('code' => -2, 'message' => "Key missing");
     }
     if (array_search($this->exec, self::$allowed_exec) === false) {
         $this->result['errors'][] = array('code' => -5, 'message' => "No method {$this->exec} allowed.");
     }
     //ONLY LOGGED USERS CAN PERFORM ACTIONS ON KEYS
     if (!$this->userIsLogged) {
         $this->result['errors'][] = array('code' => -1, 'message' => "Login is required to perform this action");
     }
 }
 private function setDados()
 {
     $dto = new RelacionamentoParametroDTO();
     $_POST = filter_input_array(INPUT_POST);
     $dto->setCdCatgRelac1(Input::get('relac_1') ? 4 : null)->setCdCatgVlRelac1((int) Input::get('relac_1'))->setCdCatgRelac2(Input::get('relac_2') ? 4 : null)->setCdCatgVlRelac2((int) Input::get('relac_2'))->setCdUsuarioCriacao(Session::get('user'))->setDtUsuarioCriacao('now()')->setCdUsuarioAtualiza(Session::get('user'))->setDtUsuarioAtualiza('now()');
     return $dto;
 }
Example #6
0
 public function setDados()
 {
     $dto = new MoradorEnderecoDTO();
     $_POST = filter_input_array(INPUT_POST);
     $dto->setNrSequencia(Input::get('id_m_end'))->setCdPessoaFisica(Input::get('cd_pessoa_fisica'))->setCdApartamento(Input::get('m_end_apartamento'))->setDtEntrada(Input::get('m_end_dt_entrada'))->setDtSaida(Input::get('m_end_dt_saida'))->setFgResidente(Input::get('residente') == '' ? null : Input::get('residente'))->setCdUsuarioCriacao(Session::get('user'))->setDtUsuarioCriacao('now()')->setCdUsuarioAtualiza(Session::get('user'))->setDtUsuarioAtualiza('now()');
     return $dto;
 }
 public function __construct()
 {
     parent::__construct();
     $filterArgs = array('job' => array('filter' => FILTER_SANITIZE_NUMBER_INT), 'segment' => array('filter' => FILTER_SANITIZE_NUMBER_INT), 'jpassword' => array('filter' => FILTER_SANITIZE_STRING, 'flags' => FILTER_FLAG_STRIP_HIGH | FILTER_FLAG_STRIP_LOW), 'err_typing' => array('filter' => FILTER_CALLBACK, 'options' => array("setRevisionController", "sanitizeFieldValue")), 'err_translation' => array('filter' => FILTER_CALLBACK, 'options' => array("setRevisionController", "sanitizeFieldValue")), 'err_terminology' => array('filter' => FILTER_CALLBACK, 'options' => array("setRevisionController", "sanitizeFieldValue")), 'err_language' => array('filter' => FILTER_CALLBACK, 'options' => array("setRevisionController", "sanitizeFieldValue")), 'err_style' => array('filter' => FILTER_CALLBACK, 'options' => array("setRevisionController", "sanitizeFieldValue")), 'original' => array('filter' => FILTER_UNSAFE_RAW));
     $postInput = filter_input_array(INPUT_POST, $filterArgs);
     $this->id_job = $postInput['job'];
     $this->password_job = $postInput['jpassword'];
     $this->id_segment = $postInput['segment'];
     $this->err_typing = $postInput['err_typing'];
     $this->err_translation = $postInput['err_translation'];
     $this->err_terminology = $postInput['err_terminology'];
     $this->err_language = $postInput['err_language'];
     $this->err_style = $postInput['err_style'];
     list($this->original_translation, $none) = CatUtils::parseSegmentSplit(CatUtils::view2rawxliff($postInput['original']), ' ');
     Log::doLog($_POST);
     if (empty($this->id_job)) {
         $this->result['errors'][] = array('code' => -1, 'message' => 'Job ID missing');
     }
     if (empty($this->id_segment)) {
         $this->result['errors'][] = array('code' => -2, 'message' => 'Segment ID missing');
     }
     if (empty($this->password_job)) {
         $this->result['errors'][] = array('code' => -3, 'message' => 'Job password missing');
     }
 }
 public function __construct()
 {
     //SESSION ENABLED
     parent::sessionStart();
     parent::__construct();
     $filterArgs = array('page' => array('filter' => FILTER_SANITIZE_NUMBER_INT), 'step' => array('filter' => FILTER_SANITIZE_NUMBER_INT), 'project' => array('filter' => FILTER_SANITIZE_NUMBER_INT), 'filter' => array('filter' => FILTER_VALIDATE_BOOLEAN, 'options' => array(FILTER_NULL_ON_FAILURE)), 'pn' => array('filter' => FILTER_SANITIZE_STRING, 'flags' => FILTER_FLAG_STRIP_HIGH | FILTER_FLAG_STRIP_LOW), 'source' => array('filter' => FILTER_SANITIZE_STRING, 'flags' => FILTER_FLAG_STRIP_HIGH | FILTER_FLAG_STRIP_LOW), 'target' => array('filter' => FILTER_SANITIZE_STRING, 'flags' => FILTER_FLAG_STRIP_HIGH | FILTER_FLAG_STRIP_LOW), 'status' => array('filter' => FILTER_SANITIZE_STRING, 'flags' => FILTER_FLAG_STRIP_HIGH | FILTER_FLAG_STRIP_LOW), 'onlycompleted' => array('filter' => FILTER_VALIDATE_BOOLEAN, 'options' => array(FILTER_NULL_ON_FAILURE)));
     $postInput = filter_input_array(INPUT_POST, $filterArgs);
     // assigning default values
     if (is_null($postInput['page']) || empty($postInput['page'])) {
         $postInput['page'] = 1;
     }
     if (is_null($postInput['step']) || empty($postInput['step'])) {
         $postInput['step'] = 25;
     }
     if (is_null($postInput['status']) || empty($postInput['status'])) {
         $postInput['status'] = Constants_JobStatus::STATUS_ACTIVE;
     }
     $this->lang_handler = Langs_Languages::getInstance();
     $this->page = (int) $postInput['page'];
     $this->step = (int) $postInput['step'];
     $this->project_id = $postInput['project'];
     $this->filter_enabled = (int) $postInput['filter'];
     $this->search_in_pname = (string) $postInput['pn'];
     $this->search_source = (string) $postInput['source'];
     $this->search_target = (string) $postInput['target'];
     $this->search_status = (string) $postInput['status'];
     $this->search_onlycompleted = $postInput['onlycompleted'];
 }
Example #9
0
 public function execute()
 {
     $config = $this->getConfig();
     $formEntradaBodega = filter_input_array(INPUT_POST)['entradaBodega'];
     $entradaBodega = new entradaSalidaBodegaTable($config);
     $entradaBodega->setTipoDocumentoId($formEntradaBodega['tipo_documento_id']);
     $entradaBodega->setTerceroIdElabora($formEntradaBodega['tercero_id_elabora']);
     $entradaBodega->setTerceroIdSolicita($formEntradaBodega['tercero_id_solicita']);
     $entradaBodega->setFecha($formEntradaBodega['fecha']);
     $entradaBodega->setObservacion($formEntradaBodega['observacion']);
     //    $detalle = new detalleEntradaSalidaBodegaTable($config);
     $cod_art = filter_input_array(INPUT_POST)['cod_art'];
     $tpd = filter_input_array(INPUT_POST)['tpd'];
     $unm = filter_input_array(INPUT_POST)['unm'];
     $cant = filter_input_array(INPUT_POST)['cant'];
     $precio = filter_input_array(INPUT_POST)['precio'];
     $contador = filter_input_array(INPUT_POST)['cta_campos'];
     $this->objEntradaBodega = $entradaBodega->save();
     $id = $entradaBodega->consById();
     for ($i = 0; $i < $contador; $i++) {
         $detalleEntradaBodega = new detalleEntradaSalidaBodegaTable($config);
         $detalleEntradaBodega->setEntradaSalidaBodegaId($id[0]->id);
         $detalleEntradaBodega->setProductoId($cod_art[$i]);
         $detalleEntradaBodega->setTpd_id(1);
         $detalleEntradaBodega->setUnidadMedidaId($unm[$i]);
         $detalleEntradaBodega->setCantidad($cant[$i]);
         $detalleEntradaBodega->setPrecio($precio[$i]);
         // Se guarda el registro en la tabla detalle
         $this->ObjFactura = $detalleEntradaBodega->save();
     }
     header('Location: ' . $config->getUrl() . 'index.php/entradaBodega/index');
 }
Example #10
0
 public function __construct()
 {
     $vars = filter_input_array(INPUT_GET, array('ftype' => FILTER_VALIDATE_INT, 'folder_id' => FILTER_VALIDATE_INT));
     $this->ftype = $vars['ftype'];
     $this->folder_id = $vars['folder_id'];
     $this->loadFactory();
 }
Example #11
0
 public function login()
 {
     $formKey = new $this->aReg->auth();
     /** @todo create standard filters for inputs */
     $post = filter_input_array(INPUT_POST);
     if (!isset($post['form_key']) || !$formKey->validate()) {
         // Form key error
         header('Location: ' . AMS_SEO_URL . 'user/signin');
     } else {
         if (isset($post['email'], $post['password'])) {
             $lp = $this->aReg->auth->login($post['email'], $post['password'], $this->aReg->db);
             /**
              * @todo login default actions
              * example $lp = loginprocessed return..
              * if($lp){$this->otherAction()}else{ $this->prime();}
              */
             if ($lp) {
                 //no differnce between mobile and classic views but it could be done here.
                 if ($_SESSION['layoutType'] !== 'classic') {
                     header('Location: ' . AMS_SEO_URL . 'prime');
                 } else {
                     header('Location: ' . AMS_SEO_URL . 'prime');
                 }
             } else {
                 $this->prime();
             }
         } else {
             header('Location: ' . AMS_SEO_URL . 'user/signin');
         }
     }
 }
Example #12
0
 public function execute()
 {
     $config = $this->getConfig();
     if (filter_has_var(INPUT_POST, 'seguridad') === TRUE) {
         $user = filter_input_array(INPUT_POST)['seguridad']['user'];
         $password = filter_input_array(INPUT_POST)['seguridad']['pass'];
         $usuario = new usuarioTable($config);
         $usuario->setUsuario($user);
         $usuario->setPassword($password);
         if ($usuario->verificarUsuario() === TRUE) {
             $datoUsuario = $usuario->getDataByUserPassword();
             if ($datoUsuario !== FALSE) {
                 $_SESSION['user']['id'] = $datoUsuario->id;
                 $_SESSION['user']['nombre'] = $datoUsuario->nombre;
                 header("Location:" . $config->getUrl() . "index.php");
                 exit;
             } else {
                 throw new Exception('Ocurrio un error usuario no existente');
             }
         } else {
             $_SESSION['usuarioInvalido'] = 'Datos de usuario son inválidos';
             header("Location:" . $config->getUrl() . "index.php/home/loginUsuario");
             exit;
         }
     }
     header("Location:" . $config->getUrl() . "index.php");
     exit;
 }
Example #13
0
function pegaInformacao($tipo_request)
{
    switch ($tipo_request) {
        case 'POST':
            $t = filter_input_array(INPUT_POST);
            break;
        case 'GET':
            $t = filter_input_array(INPUT_GET);
            break;
        case 'COOKIE':
            $t = filter_input_array(INPUT_COOKIE);
            break;
        case 'ENV':
            $t = filter_input_array(INPUT_ENV);
            break;
        case 'SESSION':
            if (isset($_SESSION)) {
                $t = $_SESSION;
            }
            break;
    }
    if (isset($t) && $t != '') {
        $string_com_todos = '';
        foreach ($t as $chave => $valor) {
            global ${$chave};
            ${$chave} = $valor;
            $string_com_todos .= $tipo_request . ' => ' . $chave . ': ' . $valor . "\n";
            /* TESTE => */
            //echo $tipo_request.' => '.$chave.': '.$valor." <br>\n";
        }
        /* TESTE => */
        //echo '<script>alert("'.$string_com_todos.'")</script>';
    }
}
 /**
  * Class Constructor
  *
  * @throws LogicException
  *
  */
 public function __construct()
 {
     if (empty($this->review_order_page)) {
         throw new LogicException("Property 'review_order_page' can not be EMPTY");
     }
     if (empty($this->tokenName)) {
         throw new LogicException("Property 'tokenName' can not be EMPTY");
     }
     //SESSION ENABLED
     $this->sessionStart();
     parent::__construct(false);
     $filterArgs = array($this->tokenName => array('filter' => FILTER_SANITIZE_STRING, 'flags' => FILTER_FLAG_STRIP_LOW | FILTER_FLAG_STRIP_HIGH), $this->dataKeyName => array('filter' => FILTER_SANITIZE_STRING, 'flags' => FILTER_FLAG_STRIP_LOW | FILTER_FLAG_STRIP_HIGH));
     $__getInput = filter_input_array(INPUT_GET, $filterArgs);
     /*
      *
      * Do something with Token ( send it for authentication on confirm )
      *
      *  $__getInput['tk']
      *
      */
     $this->tokenAuth = $__getInput[$this->tokenName];
     $this->data_key_content = $__getInput[$this->dataKeyName];
     Log::doLog($_GET);
     Log::doLog($_SERVER['QUERY_STRING']);
 }
Example #15
0
 public function index()
 {
     if (null !== filter_input_array(INPUT_POST)) {
         $post = filter_input_array(INPUT_POST);
         self::logAuth($post);
     }
 }
 /**
  * @method store verb POST
  *
  * @return string
  */
 public function store()
 {
     $options = ['username' => ['filter' => FILTER_SANITIZE_SPECIAL_CHARS]];
     $result = filter_input_array(INPUT_POST, $options);
     $username = !empty($result['username']) ? $result['username'] : 'no-body';
     return "store: {$username}";
 }
Example #17
0
 public function __construct()
 {
     $this->start_time = microtime(1) * 1000;
     parent::__construct(false);
     parent::makeTemplate("index.html");
     $filterArgs = array('jid' => array('filter' => FILTER_SANITIZE_NUMBER_INT), 'password' => array('filter' => FILTER_SANITIZE_STRING, 'flags' => FILTER_FLAG_STRIP_LOW | FILTER_FLAG_STRIP_HIGH), 'start' => array('filter' => FILTER_SANITIZE_NUMBER_INT), 'page' => array('filter' => FILTER_SANITIZE_NUMBER_INT));
     $getInput = (object) filter_input_array(INPUT_GET, $filterArgs);
     $this->jid = $getInput->jid;
     $this->password = $getInput->password;
     $this->start_from = $getInput->start;
     $this->page = $getInput->page;
     $this->job = Chunks_ChunkDao::getByIdAndPassword($this->jid, $this->password);
     if (isset($_GET['step'])) {
         $this->step = $_GET['step'];
     } else {
         $this->step = 1000;
     }
     if (is_null($this->page)) {
         $this->page = 1;
     }
     if (is_null($this->start_from)) {
         $this->start_from = ($this->page - 1) * $this->step;
     }
     if (isset($_GET['filter'])) {
         $this->filter_enabled = true;
     } else {
         $this->filter_enabled = false;
     }
     $this->downloadFileName = "";
     $this->doAuth();
     $this->generateAuthURL();
 }
Example #18
0
 static function process($filters, $source = INPUT_POST, $required_by_default = false, $strict = true)
 {
     # parse filters
     list($filters, $required, $defaults) = self::parse_filters($filters, $required_by_default);
     # apply
     $d = is_array($source) ? filter_var_array($source, $filters) : filter_input_array($source, $filters);
     if ($d === null) {
         $d = array_fill_keys(array_keys($filters), null);
     }
     # check required and set undefined to null (rather than false)
     foreach ($filters as $field => $filter) {
         $isa = is_array($filter);
         if ($d[$field] === null || $d[$field] === false && ($isa ? $filter['filter'] : $filter) !== FILTER_VALIDATE_BOOLEAN) {
             if ($strict && isset($required[$field])) {
                 throw new UnexpectedValueException($field . ' is required');
             } elseif (isset($defaults[$field])) {
                 if ($filter !== FILTER_DEFAULT) {
                     if ($isa) {
                         $d[$field] = filter_var($defaults[$field], $filter['filter'], isset($filter['options']) ? $filter['options'] : null);
                     } else {
                         $d[$field] = filter_var($defaults[$field], $filter);
                     }
                 } else {
                     $d[$field] = $defaults[$field];
                 }
             } else {
                 $d[$field] = null;
             }
         }
     }
     return $d;
 }
Example #19
0
 public function __construct() {
     @session_start();
     self::$db = Database::__getInstance();
     $this->data = filter_input_array(INPUT_POST);
     if($this->data)
         $this->csrfCheck();
 }
Example #20
0
 public function update($model, $table_id)
 {
     $this->load->library('form_validation');
     $this->load->helper('security');
     if (filter_input_array(INPUT_POST)) {
         $this->load->model($model);
         $pk = $this->input->post('pk', true);
         $where_value = $this->input->post('value', true);
         $where_column = $this->input->post('name', true);
         $rules = array(array('field' => 'value', 'label' => 'Value', 'rules' => 'required|max_length[255]|min_length[2]|encode_php_tags|trim'));
         //validation run
         $this->load->library('form_validation');
         $this->form_validation->set_rules($rules);
         $this->form_validation->set_error_delimiters('', '');
         if (!$this->form_validation->run($rules) == FALSE) {
             $success = $this->{$model}->updateRecord($table_id, [$where_column => $where_value], $pk);
             if ($success) {
                 header("HTTP/1.1 200 OK");
                 echo 'updated';
             }
         } else {
             header('HTTP/1.0 400 Bad Request', true, 400);
             echo validation_errors();
         }
     }
 }
Example #21
0
 /**
  * Initialize. Get values from _GET and _COOKIES and save to UtmCookie. Init self::$utmCookie value.
  * 
  * @return void
  */
 public static function init()
 {
     // if initializated, just return
     if (self::$utmCookie !== null) {
         return;
     }
     self::initStaticValues();
     // utm from _COOKIE
     $utmCookieFilter = filter_input(INPUT_COOKIE, self::$utmCookieName, FILTER_SANITIZE_STRING, FILTER_REQUIRE_ARRAY);
     if (false === is_array($utmCookieFilter)) {
         $utmCookieFilter = [];
     }
     $utmCookie = self::removeNullValues($utmCookieFilter);
     // utm from _GET
     $utmGetFilter = filter_input_array(INPUT_GET, ['utm_campaign' => FILTER_SANITIZE_STRING, 'utm_medium' => FILTER_SANITIZE_STRING, 'utm_source' => FILTER_SANITIZE_STRING, 'utm_term' => FILTER_SANITIZE_STRING, 'utm_content' => FILTER_SANITIZE_STRING]);
     if (false === is_array($utmGetFilter)) {
         $utmGetFilter = [];
     }
     $utmGet = self::removeNullValues($utmGetFilter);
     if (count($utmGet) !== 0 && self::$overwrite === true) {
         $utmCookieSave = array_merge(self::$utmCookie, $utmGet);
     } else {
         $utmCookieSave = array_merge(self::$utmCookie, $utmCookie, $utmGet);
     }
     if (count($utmGet) !== 0) {
         self::save($utmCookieSave);
     } else {
         self::$utmCookie = $utmCookieSave;
     }
 }
Example #22
0
/**
 * Save company finance
 */
function orbis_save_company_finance($post_id, $post)
{
    // Doing autosave
    if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {
        return;
    }
    // Verify nonce
    $nonce = filter_input(INPUT_POST, 'orbis_company_finance_meta_box_nonce', FILTER_SANITIZE_STRING);
    if (!wp_verify_nonce($nonce, 'orbis_save_company_finance')) {
        return;
    }
    // Check permissions
    if (!($post->post_type == 'orbis_company' && current_user_can('edit_post', $post_id))) {
        return;
    }
    // OK
    $definition = array('_orbis_company_ebilling' => FILTER_VALIDATE_BOOLEAN);
    $data = filter_input_array(INPUT_POST, $definition);
    foreach ($data as $key => $value) {
        if (empty($value)) {
            delete_post_meta($post_id, $key);
        } else {
            update_post_meta($post_id, $key, $value);
        }
    }
}
 public function execute()
 {
     $config = $this->getConfig();
     $index = $config->getUrl() . 'index.php';
     if (isset($_SESSION['user']) === TRUE) {
         header("Location: {$index}");
         exit;
     } elseif (filter_has_var(INPUT_POST, 'registro') === TRUE) {
         $registro = filter_input_array(INPUT_POST)['registro'];
         $this->validateInsert($registro);
         $usuario = new usuarioTable($config);
         $usuario->setId($usuario->nextId());
         $usuario->setUsuario($registro['nick']);
         $usuario->setPassword($registro['password']);
         $usuario->setActivado(1);
         $usuario->setRolId(2);
         $id = $usuario->save();
         $datoUsuario = new datoUsuarioTable($config);
         $datoUsuario->setId($datoUsuario->nextId());
         $datoUsuario->setUsuarioId($id);
         $datoUsuario->setNombre($registro['nombre']);
         $datoUsuario->setApellidos($registro['apellidos']);
         $datoUsuario->setCorreo($registro['email']);
         $datoUsuario->setFechaNacimiento($registro['fecha']);
         $datoUsuario->setGenero($registro['genero']);
         $datoUsuario->save();
         $_SESSION['registroSuccess'] = 'Usuario registrado exitosamente';
         header("Location:" . $config->getUrl() . "index.php/home/loginUsuario");
         exit;
     } else {
         $this->formulario = $this->getConfig()->getUrl() . 'index.php/seguridad/registroUsuario';
         $this->defineView('home/seguridad', 'registroUsuario', 'html');
     }
 }
Example #24
0
 public function __construct()
 {
     if (isset($_POST)) {
         $this->__POST = filter_input_array(INPUT_POST);
     }
     if (isset($_GET)) {
         $this->__GET = filter_input_array(INPUT_GET);
     }
     if (isset($_SERVER)) {
         $this->__SERVER = filter_input_array(INPUT_SERVER);
     }
     if (get_magic_quotes_gpc()) {
         $this->__POST = array_map('stripslashes', $this->__POST);
     }
     $this->params[1] = 'arg1';
     $this->params[2] = 'arg2';
     $this->params[3] = 'arg3';
     $this->params[4] = 'arg4';
     $this->params[5] = 'arg5';
     $this->params[6] = 'arg6';
     $this->params[7] = 'arg7';
     $this->params[8] = 'arg8';
     $this->params[9] = 'arg9';
     // Request URI speichern
     $this->requestURI = $this->getRequestUri();
     // Request URI am Slash aufteilen und Teile speichern
     $this->parts = $this->getRequestParts();
 }
Example #25
0
 /**
  *
  * @return requestClass
  */
 public static function getInstance()
 {
     if (!isset(self::$instance)) {
         self::$instance = new self(\filter_input_array(\INPUT_POST), \filter_input_array(\INPUT_GET), $_REQUEST, \filter_input_array(\INPUT_COOKIE), $_FILES, \filter_input_array(\INPUT_SERVER), \filter_input_array(\INPUT_ENV));
     }
     return self::$instance;
 }
/**
 * Save hosting group keychains
 */
function orbis_save_hosting_group_keychains($post_id, $post)
{
    // Doing autosave
    if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {
        return;
    }
    // Verify nonce
    $nonce = filter_input(INPUT_POST, 'orbis_hosting_group_keychains_meta_box_nonce', FILTER_SANITIZE_STRING);
    if (!wp_verify_nonce($nonce, 'orbis_save_hosting_group_keychains')) {
        return;
    }
    // Check permissions
    if (!($post->post_type == 'orbis_hosting_group' && current_user_can('edit_post', $post_id))) {
        return;
    }
    // OK
    $definition = array('_orbis_hosting_group_control_panel_keychain_id' => FILTER_SANITIZE_STRING);
    $data = filter_input_array(INPUT_POST, $definition);
    foreach ($data as $key => $value) {
        if (empty($value)) {
            delete_post_meta($post_id, $key);
        } else {
            update_post_meta($post_id, $key, $value);
        }
    }
}
Example #27
0
 public function createRequest()
 {
     $uri = $_SERVER['REQUEST_URI'];
     $basePath = $this->configuration->getBasePath();
     if ($basePath && strncmp($uri, $basePath, strlen($basePath)) !== 0) {
         throw new ApiException("Invalid endpoint");
     }
     $uri = substr($uri, strlen($basePath) - 1);
     if ($this->configuration->getPublicKey() !== trim($_SERVER['HTTP_X_API_KEY'])) {
         throw new AuthorizationException("Invalid API key");
     }
     $hasBody = $this->hasBody();
     $input = $hasBody ? file_get_contents('php://input') : '';
     $signature = hash_hmac('sha256', $uri . $input, $this->configuration->getPrivateKey());
     if ($signature !== trim($_SERVER['HTTP_X_API_SIGNATURE'])) {
         throw new AuthorizationException("Invalid signature");
     }
     if ($hasBody) {
         $parameters = json_decode($input, JSON_OBJECT_AS_ARRAY);
         if ($parameters === NULL && $input !== '' && strcasecmp(trim($input, " \t\n\r"), 'null') !== 0) {
             $error = json_last_error();
             throw new ApiException('JSON parsing error: ' . $error);
         }
     } else {
         $parameters = filter_input_array(INPUT_GET, FILTER_UNSAFE_RAW);
     }
     $name = ($a = strpos($uri, '?')) !== FALSE ? substr($uri, 0, $a) : $uri;
     return new Request(ltrim($name, '/'), $_SERVER['REQUEST_METHOD'], $parameters);
 }
 public function __construct()
 {
     parent::__construct();
     $filterArgs = array('DQF_PMANAGER_KEY' => array('filter' => FILTER_SANITIZE_STRING, 'flags' => FILTER_FLAG_STRIP_HIGH | FILTER_FLAG_STRIP_LOW));
     $postInput = filter_input_array(INPUT_POST, $filterArgs);
     $this->DQF_PMANAGER_KEY = $postInput['DQF_PMANAGER_KEY'];
 }
Example #29
0
 public function __construct()
 {
     parent::__construct();
     //Session Enabled
     $this->checkLogin();
     //Session Disabled
     $filterArgs = array('exec' => array('filter' => FILTER_SANITIZE_STRING, 'flags' => FILTER_FLAG_STRIP_HIGH | FILTER_FLAG_STRIP_LOW), 'id' => array('filter' => FILTER_SANITIZE_NUMBER_INT), 'name' => array('filter' => FILTER_SANITIZE_STRING, 'flags' => FILTER_FLAG_STRIP_HIGH | FILTER_FLAG_STRIP_LOW), 'data' => array('filter' => FILTER_SANITIZE_STRING, 'flags' => FILTER_FLAG_STRIP_HIGH | FILTER_FLAG_STRIP_LOW | FILTER_FLAG_NO_ENCODE_QUOTES), 'provider' => array('filter' => FILTER_SANITIZE_STRING, 'flags' => FILTER_FLAG_STRIP_HIGH | FILTER_FLAG_STRIP_LOW));
     $postInput = filter_input_array(INPUT_POST, $filterArgs);
     $this->exec = $postInput['exec'];
     $this->id = $postInput['id'];
     $this->name = $postInput['name'];
     $this->provider = $postInput['provider'];
     $this->engineData = json_decode($postInput['data'], true);
     if (is_null($this->exec)) {
         $this->result['errors'][] = array('code' => -1, 'message' => "Exec field required");
     } else {
         if (!in_array($this->exec, self::$allowed_actions)) {
             $this->result['errors'][] = array('code' => -2, 'message' => "Exec value not allowed");
         }
     }
     //ONLY LOGGED USERS CAN PERFORM ACTIONS ON KEYS
     if (!$this->userIsLogged) {
         $this->result['errors'][] = array('code' => -3, 'message' => "Login is required to perform this action");
     }
 }
 public function __construct()
 {
     parent::__construct();
     $filterArgs = array('id_job' => array('filter' => FILTER_SANITIZE_NUMBER_INT), 'password' => array('filter' => FILTER_SANITIZE_STRING, 'flags' => FILTER_FLAG_STRIP_LOW | FILTER_FLAG_STRIP_HIGH), 'propagate' => array('filter' => FILTER_VALIDATE_BOOLEAN, 'flags' => FILTER_NULL_ON_FAILURE), 'id_segment' => array('filter' => FILTER_SANITIZE_NUMBER_INT), 'time_to_edit' => array('filter' => FILTER_SANITIZE_NUMBER_INT), 'id_translator' => array('filter' => FILTER_SANITIZE_STRING, 'flags' => FILTER_FLAG_STRIP_LOW | FILTER_FLAG_STRIP_HIGH), 'translation' => array('filter' => FILTER_UNSAFE_RAW), 'version' => array('filter' => FILTER_SANITIZE_NUMBER_INT), 'chosen_suggestion_index' => array('filter' => FILTER_SANITIZE_NUMBER_INT), 'status' => array('filter' => FILTER_SANITIZE_STRING, 'flags' => FILTER_FLAG_STRIP_LOW | FILTER_FLAG_STRIP_HIGH), 'splitStatuses' => array('filter' => FILTER_SANITIZE_STRING, 'flags' => FILTER_FLAG_STRIP_LOW | FILTER_FLAG_STRIP_HIGH));
     $this->__postInput = filter_input_array(INPUT_POST, $filterArgs);
     $this->id_job = $this->__postInput['id_job'];
     $this->password = $this->__postInput['password'];
     $this->propagate = $this->__postInput['propagate'];
     //not used here but used in child class setAutoPropagationController
     $this->id_segment = $this->__postInput['id_segment'];
     $this->time_to_edit = (int) $this->__postInput['time_to_edit'];
     //cast to int, so the default is 0
     $this->id_translator = $this->__postInput['id_translator'];
     $this->client_target_version = empty($this->__postInput['version']) ? '0' : $this->__postInput['version'];
     list($this->translation, $this->split_chunk_lengths) = CatUtils::parseSegmentSplit(CatUtils::view2rawxliff($this->__postInput['translation']), ' ');
     $this->chosen_suggestion_index = $this->__postInput['chosen_suggestion_index'];
     $this->status = strtoupper($this->__postInput['status']);
     $this->split_statuses = explode(",", strtoupper($this->__postInput['splitStatuses']));
     //strtoupper transforms null to ""
     //PATCH TO FIX BOM INSERTIONS
     $this->translation = str_replace("", '', $this->translation);
     if (is_null($this->propagate) || !isset($this->propagate)) {
         $this->propagate = true;
     }
     Log::doLog($this->__postInput);
 }