Esempio n. 1
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");
     }
 }
Esempio n. 2
0
    public function __construct() {

        parent::__construct();

        $filterArgs = array(

            'id'          => array( 'filter' => FILTER_SANITIZE_NUMBER_INT ),
            'id_job'      => array( 'filter' => FILTER_SANITIZE_NUMBER_INT ),
            'src_content' => array( 'filter' => FILTER_UNSAFE_RAW ),
            'trg_content' => array( 'filter' => FILTER_UNSAFE_RAW ),
            'password'    => array( 'filter' => FILTER_SANITIZE_STRING, 'flags' => FILTER_FLAG_STRIP_LOW | FILTER_FLAG_STRIP_HIGH ),
            'token'       => array( 'filter' => FILTER_SANITIZE_STRING,
                                    'flags'  => FILTER_FLAG_STRIP_LOW ),
            'logs'        => array( 'filter' => FILTER_UNSAFE_RAW),
            'glossaryList' => array( 'filter' => FILTER_CALLBACK, 'options' => array('self','filterString') )
        );

        $this->__postInput = (object)filter_input_array( INPUT_POST, $filterArgs );

        if( !empty( $this->__postInput->logs ) && $this->__postInput->logs != '[]' ){
            Log::$fileName = 'clientLog.log';
            Log::doLog( json_decode( $this->__postInput->logs ) );
            Log::$fileName = 'log.txt';
        }

    }
 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);
 }
Esempio n. 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");
     }
 }
Esempio n. 5
0
 public function __construct()
 {
     parent::__construct();
     $filterArgs = array('_sub' => array('filter' => FILTER_SANITIZE_STRING), 'id_client' => array('filter' => FILTER_SANITIZE_STRING), 'id_job' => array('filter' => FILTER_SANITIZE_NUMBER_INT), 'id_segment' => array('filter' => FILTER_SANITIZE_NUMBER_INT), 'username' => array('filter' => FILTER_SANITIZE_STRING), 'source_page' => array('filter' => FILTER_SANITIZE_NUMBER_INT), 'message' => array('filter' => FILTER_UNSAFE_RAW), 'first_seg' => array('filter' => FILTER_SANITIZE_NUMBER_INT), 'last_seg' => array('filter' => FILTER_SANITIZE_NUMBER_INT), 'password' => array('filter' => FILTER_SANITIZE_STRING, 'flags' => FILTER_FLAG_STRIP_LOW | FILTER_FLAG_STRIP_HIGH));
     $this->__postInput = filter_input_array(INPUT_POST, $filterArgs);
     $this->__postInput['message'] = htmlspecialchars($this->__postInput['message']);
 }
 public function __construct()
 {
     parent::__construct();
     $this->source_language = $this->get_from_get_post('source_language');
     $this->target_language = $this->get_from_get_post('target_language');
     $this->file_name = $this->get_from_get_post('file_name');
 }
 public function __construct()
 {
     parent::__construct();
     $filterArgs = array('id_job' => array('filter' => FILTER_SANITIZE_NUMBER_INT), 'id_translator' => array('filter' => FILTER_SANITIZE_STRING, 'flags' => FILTER_FLAG_STRIP_LOW), 'id_customer' => array('filter' => FILTER_SANITIZE_STRING, 'flags' => FILTER_FLAG_STRIP_LOW), 'private_customer' => array('filter' => FILTER_SANITIZE_NUMBER_INT), 'private_translator' => array('filter' => FILTER_SANITIZE_NUMBER_INT), 'password' => array('filter' => FILTER_SANITIZE_STRING, 'flags' => FILTER_FLAG_STRIP_LOW | FILTER_FLAG_STRIP_HIGH), 'source' => array('filter' => FILTER_UNSAFE_RAW), 'target' => array('filter' => FILTER_UNSAFE_RAW), 'source_lang' => array('filter' => FILTER_SANITIZE_STRING, 'flags' => FILTER_FLAG_STRIP_LOW | FILTER_FLAG_STRIP_HIGH), 'target_lang' => array('filter' => FILTER_SANITIZE_STRING, 'flags' => FILTER_FLAG_STRIP_LOW | FILTER_FLAG_STRIP_HIGH));
     $this->__postInput = filter_input_array(INPUT_POST, $filterArgs);
     //NOTE: This is for debug purpose only,
     //NOTE: Global $_POST Overriding from CLI Test scripts
     //$this->__postInput = filter_var_array( $_POST, $filterArgs );
     $this->id_job = (int) $this->__postInput['id_job'];
     $this->translator_username = $this->__postInput['id_translator'];
     // No more used
     $this->id_customer = $this->__postInput['id_customer'];
     $this->private_customer = (int) $this->__postInput['private_customer'];
     $this->private_translator = (int) $this->__postInput['private_translator'];
     $this->password = $this->__postInput['password'];
     $this->source = $this->__postInput['source'];
     $this->target = $this->__postInput['target'];
     $this->source_lang = $this->__postInput['source_lang'];
     $this->target_lang = $this->__postInput['target_lang'];
     if (empty($this->id_customer)) {
         $this->id_customer = "Anonymous";
     }
     //XXX log contributions
     Log::$fileName = "setContribution.txt";
     Log::doLog($this->__postInput);
     Log::$fileName = "log.txt";
 }
 public function __construct()
 {
     parent::__construct();
     $filterArgs = array('function' => array('filter' => FILTER_SANITIZE_STRING, 'flags' => FILTER_FLAG_STRIP_LOW), 'job' => array('filter' => FILTER_SANITIZE_NUMBER_INT), 'token' => array('filter' => FILTER_SANITIZE_STRING, 'flags' => FILTER_FLAG_STRIP_LOW), 'source' => array('filter' => FILTER_UNSAFE_RAW), 'target' => array('filter' => FILTER_UNSAFE_RAW), 'status' => array('filter' => FILTER_SANITIZE_STRING, 'flags' => FILTER_FLAG_STRIP_LOW | FILTER_FLAG_STRIP_HIGH), 'replace' => array('filter' => FILTER_UNSAFE_RAW), 'password' => array('filter' => FILTER_UNSAFE_RAW), 'matchcase' => array('filter' => FILTER_VALIDATE_BOOLEAN), 'exactmatch' => array('filter' => FILTER_VALIDATE_BOOLEAN));
     $__postInput = filter_input_array(INPUT_POST, $filterArgs);
     $this->function = $__postInput['function'];
     //can be: search / replace
     $this->job = $__postInput['job'];
     $this->token = $__postInput['token'];
     $this->source = $__postInput['source'];
     $this->target = $__postInput['target'];
     $this->status = strtolower($__postInput['status']);
     $this->replace = $__postInput['replace'];
     $this->password = $__postInput['password'];
     $this->matchCase = $__postInput['matchcase'];
     $this->exactMatch = $__postInput['exactmatch'];
     if (empty($this->status)) {
         $this->status = "all";
     }
     switch ($this->status) {
         case 'translated':
         case 'approved':
         case 'rejected':
         case 'draft':
         case 'new':
             break;
         default:
             $this->status = "all";
             break;
     }
     $this->queryParams = new ArrayObject(array('job' => $this->job, 'password' => $this->password, 'key' => null, 'src' => null, 'trg' => null, 'status' => $this->status, 'replacement' => $this->replace, 'matchCase' => $this->matchCase, 'exactMatch' => $this->exactMatch));
 }
 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'];
 }
Esempio n. 10
0
 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');
     }
 }
Esempio n. 11
0
 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'];
 }
Esempio n. 12
0
 public static function getInstance()
 {
     if (null === self::$_instance) {
         self::$_instance = new self();
     }
     return self::$_instance;
 }
Esempio n. 13
0
 public function __construct()
 {
     parent::__construct();
     $filterArgs = array('pid' => array('filter' => FILTER_SANITIZE_NUMBER_INT), 'act' => array('filter' => FILTER_SANITIZE_STRING, 'flags' => FILTER_FLAG_STRIP_LOW | FILTER_FLAG_STRIP_HIGH));
     $__postInput = filter_input_array(INPUT_POST, $filterArgs);
     $this->id_project = (int) $__postInput['pid'];
     $this->act = $__postInput['act'];
 }
Esempio n. 14
0
 /**
  * Check Status of a created Project With HTTP POST ( application/x-www-form-urlencoded ) protocol
  *
  * POST Params:
  *
  * 'id_project'         => (int)    ID of Project to check
  * 'ppassword'          => (string) Project Password
  *
  */
 public function __construct()
 {
     parent::__construct();
     $filterArgs = array('id_project' => array('filter' => FILTER_SANITIZE_NUMBER_INT), 'project_pass' => array('filter' => FILTER_SANITIZE_STRING, 'flags' => FILTER_FLAG_STRIP_LOW | FILTER_FLAG_STRIP_HIGH));
     $__postInput = filter_input_array(INPUT_GET, $filterArgs);
     $this->id_project = $__postInput['id_project'];
     $this->ppassword = $__postInput['project_pass'];
 }
 public function __construct()
 {
     parent::__construct();
     $filterArgs = array('first_segment' => array('filter' => FILTER_SANITIZE_NUMBER_INT), 'last_segment' => array('filter' => FILTER_SANITIZE_NUMBER_INT), 'last_timestamp' => array('filter' => FILTER_SANITIZE_NUMBER_INT));
     $__postInput = filter_input_array(INPUT_POST, $filterArgs);
     //NOTE: This is for debug purpose only,
     //NOTE: Global $_POST Overriding from CLI Test scripts
     //$__postInput = filter_var_array( $_POST, $filterArgs );
     $this->last_timestamp = $__postInput['last_timestamp'] / 1000;
     $this->first_segment = $__postInput['first_segment'];
     $this->last_segment = $__postInput['last_segment'];
 }
 public function __construct()
 {
     parent::checkLogin();
     parent::__construct();
     $filterArgs = array('res' => array('filter' => FILTER_SANITIZE_STRING, 'flags' => FILTER_FLAG_STRIP_LOW | FILTER_FLAG_STRIP_HIGH), 'id' => array('filter' => FILTER_SANITIZE_NUMBER_INT), 'password' => array('filter' => FILTER_SANITIZE_STRING, 'flags' => FILTER_FLAG_STRIP_LOW | FILTER_FLAG_STRIP_HIGH), 'old_password' => array('filter' => FILTER_SANITIZE_STRING, 'flags' => FILTER_FLAG_STRIP_LOW | FILTER_FLAG_STRIP_HIGH), 'undo' => array('filter' => FILTER_VALIDATE_BOOLEAN));
     $__postInput = filter_input_array(INPUT_POST, $filterArgs);
     $this->res_type = $__postInput['res'];
     $this->res_id = $__postInput['id'];
     $this->password = $__postInput['password'];
     $this->old_password = $__postInput['old_password'];
     $this->undo = $__postInput['undo'];
 }
 public function __construct()
 {
     parent::__construct();
     $filterArgs = array('id_segment' => array('filter' => FILTER_SANITIZE_NUMBER_INT), 'id_job' => array('filter' => FILTER_SANITIZE_NUMBER_INT), 'password' => array('filter' => FILTER_SANITIZE_STRING, 'flags' => FILTER_FLAG_STRIP_LOW | FILTER_FLAG_STRIP_HIGH));
     $__postInput = filter_input_array(INPUT_POST, $filterArgs);
     //NOTE: This is for debug purpose only,
     //NOTE: Global $_POST Overriding from CLI Test scripts
     //$__postInput = filter_var_array( $_POST, $filterArgs );
     $this->id_segment = $__postInput['id_segment'];
     $this->id_job = (int) $__postInput['id_job'];
     $this->password = $__postInput['password'];
 }
Esempio n. 18
0
 public function __construct()
 {
     //SESSION ENABLED
     parent::sessionStart();
     parent::__construct();
     //set parameters
     if (isset($_POST['login']) and !empty($_POST['login'])) {
         $this->login = $_POST['login'];
     }
     if (isset($_POST['pass']) and !empty($_POST['pass'])) {
         $this->pass = $_POST['pass'];
     }
 }
 public function __construct()
 {
     parent::__construct();
     $filterArgs = array('source_lang' => array('filter' => FILTER_SANITIZE_STRING, 'flags' => FILTER_FLAG_STRIP_LOW), 'target_lang' => array('filter' => FILTER_SANITIZE_STRING, 'flags' => FILTER_FLAG_STRIP_LOW), 'seg' => array('filter' => FILTER_UNSAFE_RAW), 'tra' => array('filter' => FILTER_UNSAFE_RAW), 'id_translator' => array('filter' => FILTER_SANITIZE_STRING, 'flags' => FILTER_FLAG_STRIP_LOW), 'password' => array('filter' => FILTER_SANITIZE_STRING, 'flags' => FILTER_FLAG_STRIP_LOW), 'id_job' => array('filter' => FILTER_SANITIZE_NUMBER_INT));
     $__postInput = filter_input_array(INPUT_POST, $filterArgs);
     $this->source_lang = $__postInput['source_lang'];
     $this->target_lang = $__postInput['target_lang'];
     $this->source = trim($__postInput['seg']);
     $this->target = trim($__postInput['tra']);
     $this->id_translator = trim($__postInput['id_translator']);
     //no more used
     $this->password = trim($__postInput['password']);
     $this->id_job = $__postInput['id_job'];
 }
Esempio n. 20
0
 /**
  * Class constructor, validate/sanitize incoming params
  *
  */
 public function __construct()
 {
     //SESSION ENABLED
     parent::sessionStart();
     parent::__construct();
     $filterArgs = array('pid' => array('filter' => FILTER_SANITIZE_NUMBER_INT), 'ppassword' => array('filter' => FILTER_SANITIZE_STRING, 'flags' => FILTER_FLAG_STRIP_LOW | FILTER_FLAG_STRIP_HIGH), 'currency' => array('filter' => FILTER_SANITIZE_STRING), 'timezone' => array('filter' => FILTER_SANITIZE_STRING), 'fixedDelivery' => array('filter' => FILTER_SANITIZE_NUMBER_INT), 'typeOfService' => array('filter' => FILTER_SANITIZE_STRING), 'jobs' => array('filter' => FILTER_SANITIZE_STRING, 'flags' => FILTER_REQUIRE_ARRAY | FILTER_FLAG_STRIP_LOW | FILTER_FLAG_STRIP_HIGH));
     $__postInput = filter_input_array(INPUT_POST, $filterArgs);
     //NOTE: This is for debug purpose only,
     //NOTE: Global $_POST Overriding from CLI
     //$__postInput = filter_var_array( $_POST, $filterArgs );
     $this->pid = $__postInput['pid'];
     $this->ppassword = $__postInput['ppassword'];
     $this->currency = $__postInput['currency'];
     $this->timezone = $__postInput['timezone'];
     $this->fixedDelivery = $__postInput['fixedDelivery'];
     $this->typeOfService = $__postInput['typeOfService'];
     $this->jobList = $__postInput['jobs'];
     if (empty($this->pid)) {
         $this->result['errors'][] = array("code" => -1, "message" => "No id project provided");
     }
     if (empty($this->ppassword)) {
         $this->result['errors'][] = array("code" => -2, "message" => "No project Password Provided");
     }
     if (empty($this->currency)) {
         $this->currency = @$_COOKIE["matecat_currency"];
     }
     if (empty($this->timezone) && $this->timezone !== "0") {
         $this->timezone = @$_COOKIE["matecat_timezone"];
     }
     if (!in_array($this->typeOfService, array("premium", "professional"))) {
         $this->typeOfService = "professional";
     }
     //        Log::doLog(  $this->jobList  );
     /**
      * The Job List form
      *
      * <pre>
      * Ex:
      *   array(
      *      0 => array(
      *          'id' => 5901,
      *          'jpassword' => '6decb661a182',
      *      ),
      *   );
      * </pre>
      */
     if (empty($this->jobList)) {
         $this->result['errors'][] = array("code" => -3, "message" => "No job list Provided");
     }
 }
Esempio n. 21
0
 public function __construct()
 {
     parent::__construct();
     $filterArgs = array('name' => array('filter' => FILTER_SANITIZE_STRING, 'flags' => FILTER_FLAG_STRIP_LOW | FILTER_FLAG_STRIP_HIGH), 'tm_key' => array('filter' => FILTER_SANITIZE_STRING, 'flags' => FILTER_FLAG_STRIP_LOW | FILTER_FLAG_STRIP_HIGH), 'exec' => array('filter' => FILTER_SANITIZE_STRING, 'flags' => FILTER_FLAG_STRIP_LOW | FILTER_FLAG_STRIP_HIGH));
     $postInput = (object) filter_input_array(INPUT_POST, $filterArgs);
     $this->name = $postInput->name;
     $this->tm_key = $postInput->tm_key;
     $this->exec = $postInput->exec;
     if (!isset($this->tm_key) || is_null($this->tm_key) || empty($this->tm_key)) {
         $this->result['errors'][] = array("code" => -2, "message" => "Please specify a TM key.");
     }
     if (empty($this->exec) || !in_array($this->exec, self::$acceptedActions)) {
         $this->result['errors'][] = array("code" => -7, "message" => "Action not valid.");
     }
 }
 public function __construct()
 {
     parent::__construct();
     $filterArgs = array('file_name' => array('filter' => FILTER_SANITIZE_STRING, 'flags' => FILTER_FLAG_STRIP_LOW), 'source_lang' => array('filter' => FILTER_SANITIZE_STRING, 'flags' => FILTER_FLAG_STRIP_LOW | FILTER_FLAG_STRIP_HIGH), 'target_lang' => array('filter' => FILTER_SANITIZE_STRING, 'flags' => FILTER_FLAG_STRIP_LOW | FILTER_FLAG_STRIP_HIGH), 'segmentation_rule' => array('filter' => FILTER_SANITIZE_STRING, 'flags' => FILTER_FLAG_STRIP_LOW | FILTER_FLAG_STRIP_HIGH));
     $postInput = filter_input_array(INPUT_POST, $filterArgs);
     $this->file_name = $postInput['file_name'];
     $this->source_lang = $postInput["source_lang"];
     $this->target_lang = $postInput["target_lang"];
     $this->segmentation_rule = $postInput["segmentation_rule"];
     if ($this->segmentation_rule == "") {
         $this->segmentation_rule = null;
     }
     $this->intDir = INIT::$UPLOAD_REPOSITORY . DIRECTORY_SEPARATOR . $_COOKIE['upload_session'];
     $this->errDir = INIT::$STORAGE_DIR . DIRECTORY_SEPARATOR . 'conversion_errors' . DIRECTORY_SEPARATOR . $_COOKIE['upload_session'];
 }
Esempio n. 23
0
 public function __construct()
 {
     parent::__construct();
     $filterArgs = array('exec' => array('filter' => FILTER_SANITIZE_STRING, 'flags' => FILTER_FLAG_STRIP_LOW | FILTER_FLAG_STRIP_HIGH), 'id_job' => array('filter' => FILTER_SANITIZE_NUMBER_INT), 'password' => array('filter' => FILTER_SANITIZE_STRING, 'flags' => FILTER_FLAG_STRIP_LOW | FILTER_FLAG_STRIP_HIGH), 'segment' => array('filter' => FILTER_UNSAFE_RAW), 'translation' => array('filter' => FILTER_UNSAFE_RAW), 'comment' => array('filter' => FILTER_UNSAFE_RAW), 'automatic' => array('filter' => FILTER_VALIDATE_BOOLEAN));
     $__postInput = filter_input_array(INPUT_POST, $filterArgs);
     //NOTE: This is for debug purpose only,
     //NOTE: Global $_POST Overriding from CLI
     //$__postInput = filter_var_array( $_POST, $filterArgs );
     $this->exec = $__postInput['exec'];
     $this->id_job = $__postInput['id_job'];
     $this->password = $__postInput['password'];
     $this->segment = $__postInput['segment'];
     $this->translation = $__postInput['translation'];
     $this->comment = $__postInput['comment'];
     $this->automatic = $__postInput['automatic'];
 }
Esempio n. 24
0
 public function __construct()
 {
     //SESSION ENABLED
     parent::sessionStart();
     parent::__construct();
     //        $gets = $_GET;
     //        foreach ( $gets as $key => &$value ) {
     //            $value = filter_var( $value, FILTER_SANITIZE_STRING, array( 'flags' => FILTER_FLAG_STRIP_LOW ) );
     //        }
     //        $this->__getInput = $gets;
     $posts = $_POST;
     foreach ($posts as $key => &$value) {
         $value = filter_var($value, FILTER_SANITIZE_STRING, array('flags' => FILTER_FLAG_STRIP_LOW));
     }
     $this->__postInput = $posts;
 }
Esempio n. 25
0
 public function __construct()
 {
     //SESSION ENABLED
     parent::sessionStart();
     parent::__construct();
     $filterArgs = array('exec' => array('filter' => FILTER_SANITIZE_STRING, 'flags' => FILTER_FLAG_STRIP_LOW | FILTER_FLAG_STRIP_HIGH), 'project_id' => array('filter' => FILTER_SANITIZE_NUMBER_INT), 'project_pass' => array('filter' => FILTER_SANITIZE_STRING, 'flags' => FILTER_FLAG_STRIP_LOW | FILTER_FLAG_STRIP_HIGH), 'job_id' => array('filter' => FILTER_SANITIZE_NUMBER_INT), 'job_pass' => array('filter' => FILTER_SANITIZE_STRING, 'flags' => FILTER_FLAG_STRIP_LOW | FILTER_FLAG_STRIP_HIGH), 'num_split' => array('filter' => FILTER_SANITIZE_NUMBER_INT), 'split_values' => array('filter' => FILTER_CALLBACK, 'options' => array('self', 'valuesToInt')));
     $__postInput = filter_input_array(INPUT_POST, $filterArgs);
     //NOTE: This is for debug purpose only,
     //NOTE: Global $_POST Overriding from CLI Test scripts
     //$__postInput = filter_var_array( $_POST, $filterArgs );
     $this->exec = $__postInput['exec'];
     $this->project_id = $__postInput['project_id'];
     $this->project_pass = $__postInput['project_pass'];
     $this->job_id = $__postInput['job_id'];
     $this->job_pass = $__postInput['job_pass'];
     $this->num_split = $__postInput['num_split'];
     $this->split_values = $__postInput['split_values'];
 }
 protected function __construct()
 {
     parent::__construct();
     $this->setErrorMap();
     $filterArgs = array('id_job' => array('filter' => FILTER_SANITIZE_NUMBER_INT), 'pass' => array('filter' => FILTER_SANITIZE_STRING, 'flags' => FILTER_FLAG_STRIP_LOW | FILTER_FLAG_STRIP_HIGH));
     $postInput = filter_input_array(INPUT_POST, $filterArgs);
     $this->id_job = $postInput['id_job'];
     $this->pass = $postInput['pass'];
     Log::doLog("Requested massive copy-source-to-target for job {$this->id_job}.");
     if (empty($this->id_job)) {
         $errorCode = -1;
         $this->addError($errorCode);
     }
     if (empty($this->pass)) {
         $errorCode = -2;
         $this->addError($errorCode);
     }
 }
 public function __construct()
 {
     parent::__construct();
     $filterArgs = array('source' => array('filter' => FILTER_UNSAFE_RAW), 'target' => array('filter' => FILTER_UNSAFE_RAW), 'source_lang' => array('filter' => FILTER_SANITIZE_STRING, 'flags' => FILTER_FLAG_STRIP_LOW | FILTER_FLAG_STRIP_HIGH), 'target_lang' => array('filter' => FILTER_SANITIZE_STRING, 'flags' => FILTER_FLAG_STRIP_LOW | FILTER_FLAG_STRIP_HIGH), 'id_segment' => array('filter' => FILTER_SANITIZE_NUMBER_INT), 'id_job' => array('filter' => FILTER_SANITIZE_NUMBER_INT), 'chosen_suggestion_index' => array('filter' => FILTER_SANITIZE_NUMBER_INT), 'password' => array('filter' => FILTER_SANITIZE_STRING, 'flags' => FILTER_FLAG_STRIP_LOW | FILTER_FLAG_STRIP_HIGH), 'time_to_edit' => array('filter' => FILTER_SANITIZE_NUMBER_INT));
     $this->__postInput = filter_input_array(INPUT_POST, $filterArgs);
     //NOTE: This is for debug purpose only,
     //NOTE: Global $_POST Overriding from CLI Test scripts
     //$this->__postInput = filter_var_array( $_POST, $filterArgs );
     $this->segment = $this->__postInput['source'];
     $this->translation = $this->__postInput['target'];
     $this->source_lang = $this->__postInput['source_lang'];
     $this->target_lang = $this->__postInput['target_lang'];
     $this->id_segment = (int) $this->__postInput['id_segment'];
     $this->id_job = (int) $this->__postInput['id_job'];
     $this->chosen_suggestion_index = $this->__postInput['chosen_suggestion_index'];
     $this->password = $this->__postInput['password'];
     $this->time_to_edit = $this->__postInput['time_to_edit'];
 }
 public function __construct()
 {
     parent::__construct();
     //Session Enabled
     $this->checkLogin();
     //Session Disabled
     $filterArgs = array('id_job' => array('filter' => FILTER_SANITIZE_NUMBER_INT), 'id_segment' => array('filter' => FILTER_SANITIZE_NUMBER_INT), 'password' => array('filter' => FILTER_SANITIZE_STRING, 'flags' => FILTER_FLAG_STRIP_LOW | FILTER_FLAG_STRIP_HIGH), 'segment' => array('filter' => FILTER_UNSAFE_RAW), 'target' => array('filter' => FILTER_UNSAFE_RAW), 'exec' => array('filter' => FILTER_SANITIZE_STRING, 'flags' => FILTER_FLAG_STRIP_LOW | FILTER_FLAG_STRIP_HIGH));
     $postInput = filter_input_array(INPUT_POST, $filterArgs);
     $this->id_job = $postInput['id_job'];
     $this->id_segment = $postInput['id_segment'];
     $this->job_pass = $postInput['password'];
     $this->segment = $postInput['segment'];
     $this->target = $postInput['target'];
     $this->exec = $postInput['exec'];
     //        if ( !$this->userIsLogged ) {
     //            $this->result[ 'errors' ][ ] = array(
     //                    'code'    => -2,
     //                    'message' => "Login is required to perform this action"
     //            );
     //        }
     if (empty($this->id_job)) {
         $this->result['errors'][] = array('code' => -3, 'message' => 'Invalid job id');
     }
     if (empty($this->id_segment)) {
         $this->result['errors'][] = array('code' => -4, 'message' => 'Invalid segment id');
     }
     if (empty($this->job_pass)) {
         $this->result['errors'][] = array('code' => -5, 'message' => 'Invalid job password');
     }
     //this checks that the json is valid, but not its content
     if (is_null($this->segment)) {
         $this->result['errors'][] = array('code' => -6, 'message' => 'Invalid source_chunk_lengths json');
     }
     /*
     else if ( empty( $this->source_chunk_lengths ) ) {
         $this->result[ 'errors' ][ ] = array(
                 'code'    => -6,
                 'message' => 'source_chunk_lengths cannot be empty'
         );
     }
     */
 }
 /**
  * Class constructor, validate/sanitize incoming params
  *
  */
 public function __construct()
 {
     parent::__construct();
     /* Retrieve parameetrs from post, and sanitize their values */
     $filterArgs = array('amount' => array('filter' => FILTER_SANITIZE_NUMBER_FLOAT, 'flags' => FILTER_FLAG_ALLOW_FRACTION), 'currencyFrom' => array('filter' => FILTER_SANITIZE_STRING), 'currencyTo' => array('filter' => FILTER_SANITIZE_STRING));
     $__postInput = filter_input_array(INPUT_POST, $filterArgs);
     $this->amount = $__postInput['amount'];
     $this->currencyFrom = $__postInput['currencyFrom'];
     $this->currencyTo = $__postInput['currencyTo'];
     /* Check the parameters consistency and correctness */
     if (empty($this->amount)) {
         $this->result['errors'][] = array("code" => -1, "message" => "No amount provided");
     }
     if (empty($this->currencyFrom)) {
         $this->result['errors'][] = array("code" => -2, "message" => "No starting currency provided");
     }
     if (empty($this->currencyTo)) {
         $this->result['errors'][] = array("code" => -3, "message" => "No target currency provided");
     }
 }
 public function __construct()
 {
     parent::__construct();
     $filterArgs = array('id_segment' => array('filter' => FILTER_SANITIZE_NUMBER_INT), 'id_job' => array('filter' => FILTER_SANITIZE_NUMBER_INT), 'num_results' => array('filter' => FILTER_SANITIZE_NUMBER_INT), 'text' => array('filter' => FILTER_UNSAFE_RAW), 'id_translator' => array('filter' => FILTER_SANITIZE_STRING, 'flags' => FILTER_FLAG_STRIP_LOW), 'password' => array('filter' => FILTER_SANITIZE_STRING, 'flags' => FILTER_FLAG_STRIP_LOW), 'is_concordance' => array('filter' => FILTER_VALIDATE_BOOLEAN), 'from_target' => array('filter' => FILTER_VALIDATE_BOOLEAN));
     $this->__postInput = filter_input_array(INPUT_POST, $filterArgs);
     //NOTE: This is for debug purpose only,
     //NOTE: Global $_POST Overriding from CLI
     //$this->__postInput = filter_var_array( $_POST, $filterArgs );
     $this->id_segment = $this->__postInput['id_segment'];
     $this->id_job = $this->__postInput['id_job'];
     $this->num_results = $this->__postInput['num_results'];
     $this->text = trim($this->__postInput['text']);
     $this->id_translator = $this->__postInput['id_translator'];
     $this->concordance_search = $this->__postInput['is_concordance'];
     $this->switch_languages = $this->__postInput['from_target'];
     $this->password = $this->__postInput['password'];
     if ($this->id_translator == 'unknown_translator') {
         $this->id_translator = "";
     }
 }