当前位置: 首页>>代码示例>>PHP>>正文


PHP InputFilter::validateInput方法代码示例

本文整理汇总了PHP中InputFilter::validateInput方法的典型用法代码示例。如果您正苦于以下问题:PHP InputFilter::validateInput方法的具体用法?PHP InputFilter::validateInput怎么用?PHP InputFilter::validateInput使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在InputFilter的用法示例。


在下文中一共展示了InputFilter::validateInput方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: WebResource

 /**
  * WebResource
  *
  * @param string $uri
  * @param string $post
  *
  * @return none
  */
 function WebResource($uri, $post)
 {
     $this->_uri = $uri;
     if (isset($post['function']) && $post['function'] != '') {
         /*Call a function*/
         header('Content-Type: text/json');
         //$parameters=G::json_decode((urldecode($post['parameters']))); //for %AC
         $parameters = G::json_decode($post['parameters']);
         $paramsRef = array();
         foreach ($parameters as $key => $value) {
             if (is_string($key)) {
                 $paramsRef[] = "\$parameters['" . addcslashes($key, '\\\'') . "']";
             } else {
                 $paramsRef[] = '$parameters[' . $key . ']';
             }
         }
         $paramsRef = implode(',', $paramsRef);
         G::LoadSystem('inputfilter');
         $filter = new InputFilter();
         $post['function'] = $filter->validateInput($post['function']);
         $paramsRef = $filter->validateInput($paramsRef);
         $res = eval('return ($this->' . $post['function'] . '(' . $paramsRef . '));');
         $res = G::json_encode($res);
         print $res;
     } else {
         /*Print class definition*/
         $this->_encode();
     }
 }
开发者ID:emildev35,项目名称:processmaker,代码行数:37,代码来源:class.webResource.php

示例2: explode

 /**
  * Run an external command, using a message callback to report
  * output.  The command will be run through popen and output is
  * reported for every line with a "cmdoutput" message with the
  * line string, including newlines, as payload.
  *
  * @param string $command the command to run
  *
  * @param mixed $callback (optional) function to use as message
  * callback
  *
  * @return bool whether the command was successful (exit code 0
  * means success, any other means failure)
  *
  * @access private
  */
 function _runCommand($command, $callback = null)
 {
     if (!class_exists('G')) {
         $realdocuroot = str_replace('\\', '/', $_SERVER['DOCUMENT_ROOT']);
         $docuroot = explode('/', $realdocuroot);
         array_pop($docuroot);
         $pathhome = implode('/', $docuroot) . '/';
         array_pop($docuroot);
         $pathTrunk = implode('/', $docuroot) . '/';
         require_once $pathTrunk . 'gulliver/system/class.g.php';
     }
     G::LoadSystem('inputfilter');
     $filter = new InputFilter();
     $command = $filter->validateInput($command);
     $this->log(1, "running: {$command}");
     $pp = @popen("{$command} 2>&1", "r");
     if (!$pp) {
         return $this->raiseError("failed to run `{$command}'");
     }
     while ($line = fgets($pp, 1024)) {
         if ($callback) {
             call_user_func($callback, 'cmdoutput', $line);
         } else {
             $this->log(2, rtrim($line));
         }
     }
     $exitcode = @pclose($pp);
     return $exitcode == 0;
 }
开发者ID:emildev35,项目名称:processmaker,代码行数:45,代码来源:Builder.php

示例3: getAllData

    public function getAllData($sUID, $start = null, $limit = null, $keyOrderUppercase = true, $filter = '', $appUid = false)
    {
        $addTab = new AdditionalTables();
        $aData = $addTab->load($sUID, true);
        if (!isset($_SESSION['PROCESS'])) {
            $_SESSION["PROCESS"] = $aData['PRO_UID'];
        }
        $aData['DBS_UID'] = $aData['DBS_UID'] ? $aData['DBS_UID'] : 'workflow';
        $sPath = PATH_DB . SYS_SYS . PATH_SEP . 'classes' . PATH_SEP;
        $sClassName = ($aData['ADD_TAB_CLASS_NAME'] != ''
                       ? $aData['ADD_TAB_CLASS_NAME']
                       : $this->getPHPName($aData['ADD_TAB_NAME']));

        if (file_exists($sPath . $sClassName . '.php')) {
            require_once $sPath . $sClassName . '.php';
        } else {
            return null;
        }

        $sClassPeerName = $sClassName . 'Peer';
        $con = Propel::getConnection($aData['DBS_UID']);
        $oCriteria = new Criteria($aData['DBS_UID']);

        //eval('$oCriteria->addSelectColumn("\'1\' AS DUMMY");');

        /*
         * data type:
         * 'INTEGER'  'BIGINT'  'SMALLINT'  'TINYINT'  'DECIMAL'  'DOUBLE'  'FLOAT'  'REAL'
         * 'CHAR'  'VARCHAR'  'LONGVARCHAR'  'BOOLEAN'  'DATE'  'DATETIME'  'TIME'
         */
        $types = array('DECIMAL', 'DOUBLE', 'FLOAT', 'REAL');

        if ($keyOrderUppercase) {
            foreach ($aData['FIELDS'] as $aField) {
                $field = '$oCriteria->addSelectColumn(' . $sClassPeerName . '::' . $aField['FLD_NAME'] . ');';
                if (in_array($aField['FLD_TYPE'], $types)) {
                    $field = '$oCriteria->addAsColumn("' . $aField['FLD_NAME'] . '", "round(" . ' . $sClassPeerName . '::' . $aField['FLD_NAME'] . ' . ", ' . ($aField['FLD_TYPE'] == 'DOUBLE' ? '8' : '2') . ')");';
                }
                eval($field);
                /*if ($aField['FLD_KEY'] == '1') {
                    eval('$oCriteria->addAscendingOrderByColumn('. $sClassPeerName . '::' . $aField['FLD_NAME'] . ');');
                }*/
            }
        }
        $oCriteriaCount = clone $oCriteria;
        //$count = $sClassPeerName::doCount($oCriteria);
        eval('$count = ' . $sClassPeerName . '::doCount($oCriteria);');

        if ($filter != '' && is_string($filter)) {
            $stringOr = '';
            $closure = '';
            $types = array('INTEGER', 'BIGINT', 'SMALLINT', 'TINYINT', 'DECIMAL', 'DOUBLE', 'FLOAT', 'REAL');
            foreach ($aData['FIELDS'] as $aField) {
	            if (($appUid == false && $aField['FLD_NAME'] != 'APP_UID') || ($appUid == true)) {
	                if (in_array($aField['FLD_TYPE'], $types)) {
	                    if (is_numeric($filter)) {
	                        $stringOr = $stringOr . '$a = $oCriteria->getNewCriterion(' . $sClassPeerName . '::' . $aField['FLD_NAME'] . ', "' . $filter . '", Criteria::EQUAL)' . $closure . ';';
	                        $closure = '->addOr($a)';
	                    }
	                } else {
	                    $stringOr = $stringOr . '$a = $oCriteria->getNewCriterion(' . $sClassPeerName . '::' . $aField['FLD_NAME'] . ', "%' . $filter . '%", Criteria::LIKE)' . $closure . ';';
	                    $closure = '->addOr($a)';
	                }
	            }
            }
            $stringOr = $stringOr . '$oCriteria->add($a);';
            eval($stringOr);

            $oCriteriaCount = clone $oCriteria;
            eval('$count = ' . $sClassPeerName . '::doCount($oCriteria);');
        }
        G::LoadSystem('inputfilter');
        $filter = new InputFilter();        
        $sClassPeerName = $filter->validateInput($sClassPeerName);

        if (isset($_POST['sort'])) {
            $_POST['sort'] = $filter->validateInput($_POST['sort']);
            $_POST['dir'] = $filter->validateInput($_POST['dir']);
            if ($_POST['dir'] == 'ASC') {
                if ($keyOrderUppercase) {
                    eval('$oCriteria->addAscendingOrderByColumn("' . $_POST['sort'] . '");');
                } else {
                    eval('$oCriteria->addAscendingOrderByColumn(' . $sClassPeerName . '::' . $_POST['sort'] . ');');
                }
            } else {
                if ($keyOrderUppercase) {
                    eval('$oCriteria->addDescendingOrderByColumn("' . $_POST['sort'] . '");');
                } else {
                    eval('$oCriteria->addDescendingOrderByColumn(' . $sClassPeerName . '::' . $_POST['sort'] . ');');
                }
            }
        }

        if (isset($limit)) {
            $oCriteria->setLimit($limit);
        }
        if (isset($start)) {
            $oCriteria->setOffset($start);
        }
        //$rs = $sClassPeerName::doSelectRS($oCriteria);
//.........这里部分代码省略.........
开发者ID:rrsc,项目名称:processmaker,代码行数:101,代码来源:AdditionalTables.php

示例4: getDataGrid


//.........这里部分代码省略.........
                                $oTmpCriteria = $oNewCriteria->getNewCriterion($field, $search);
                            }
                        } else {
                            $oTmpCriteria = $oNewCriteria->getNewCriterion($field, "%" . $search . "%", Criteria::LIKE);
                        }
                    } else {
                        if ($dataType[$index] == 'currency' || $dataType[$index] == 'percentage') {
                            if ( is_numeric($search) || is_float($search) ) {
                                $oTmpCriteria = $oNewCriteria->getNewCriterion($field, $search)->addOr($oTmpCriteria);
                            }
                        } else {
                            $oTmpCriteria = $oNewCriteria->getNewCriterion($field, "%" . $search . "%", Criteria::LIKE)->addOr($oTmpCriteria);
                        }
                    }

                    $sw = 1;
                }

                if ($oTmpCriteria != null) {
                    $oCriteria->add(
                        $oCriteria->getNewCriterion(AppCacheViewPeer::APP_NUMBER, $search, Criteria::LIKE)->addOr($oTmpCriteria)
                    );
                } else {
                    $oCriteria->add($oCriteria->getNewCriterion(AppCacheViewPeer::APP_NUMBER, $search, Criteria::LIKE));
                }
            }
            
            G::LoadSystem('inputfilter');
            $filter = new \InputFilter();

            if ($sort != "") {
                $reportTable = new ReportTables();
                $arrayReportTableVar = $reportTable->getTableVars($tableUid);
                $tableName = $filter->validateInput($tableName);
                $sort = $filter->validateInput($sort);
                if (in_array($sort, $arrayReportTableVar)) {
                    $sort = strtoupper($sort);
                    eval('$field = ' . $tableName . 'Peer::' . $sort . ';');
                } else {
                    eval('$field = AppCacheViewPeer::' . $sort . ';');
                }

                if ($dir == "ASC") {
                    $oCriteria->addAscendingOrderByColumn($field);
                } else {
                    $oCriteria->addDescendingOrderByColumn($field);
                }
            } else {
                $oCriteria->addDescendingOrderByColumn(AppCacheViewPeer::APP_NUMBER);
            }

            //pagination pagination attributes
            $oCriteria->setLimit($limit);
            $oCriteria->setOffset($start);
            //end of pagination attributes

            $oDataset = AppCacheViewPeer::doSelectRS($oCriteria);
            //eval('$oDataset = '.$className.'Peer::doSelectRS($oCriteria);');

            $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
            //$oDataset->next();

            $aTaskConsolidated = array();

            while ($oDataset->next()) {
                $aRow = $oDataset->getRow();
开发者ID:hpx2206,项目名称:processmaker-1,代码行数:67,代码来源:Consolidated.php

示例5: checkLock

 /**
  * checkLock() helper
  *
  * @param string resource path to check for locks
  * @return bool true on success
  */
 public function checkLock($path)
 {
     G::LoadSystem('inputfilter');
     $filter = new InputFilter();
     $path = $filter->validateInput($path, 'nosql');
     $result = false;
     $query = "SELECT owner, token, expires, exclusivelock\n              FROM locks\n            WHERE path = '%s' ";
     $query = $filter->preventSqlInjection($query, array($path));
     $res = mysql_query($query);
     if ($res) {
         $row = mysql_fetch_array($res);
         mysql_free_result($res);
         if ($row) {
             $result = array("type" => "write", "scope" => $row["exclusivelock"] ? "exclusive" : "shared", "depth" => 0, "owner" => $row['owner'], "token" => $row['token'], "expires" => $row['expires']);
         }
     }
     return $result;
 }
开发者ID:emildev35,项目名称:processmaker,代码行数:24,代码来源:class.webdav.php

示例6: NewCase

function NewCase($params)
{
    G::LoadClass('wsBase');
    G::LoadClass('sessions');
    G::LoadSystem('inputfilter');
    $filter = new InputFilter();
    ifSessionExpiredBreakThis($params->sessionId);
    $x = ifPermission($params->sessionId, 'PM_CASES');
    if ($x == 0) {
        G::LoadClass('wsResponse');
        $result = new wsResponse(24, G::LoadTranslation('ID_NOT_PRIVILEGES'));
        return $result;
    }
    $oSessions = new Sessions();
    $session = $oSessions->getSessionUser($params->sessionId);
    $userId = $session['USR_UID'];
    $variables = $params->variables;
    if (!isset($params->variables)) {
        $variables = array();
        $Fields = array();
    } else {
        if (is_object($variables)) {
            /*foreach ( $variables as $key=>$val ) {
              $name  = $val->name;
              $value = $val->value;
              $Fields[ $val->name ]= $val->value ;
              }*/
            $Fields[$variables->name] = $variables->value;
        }
        if (is_array($variables)) {
            foreach ($variables as $key => $val) {
                $name = $val->name;
                $value = $val->value;
                if (!is_object($val->value)) {
                    $val->name = $filter->validateInput($val->name);
                    $val->value = $filter->validateInput($val->value);
                    eval('$Fields[ ' . $val->name . ' ]= $val->value ;');
                } else {
                    if (is_array($val->value->item)) {
                        $i = 1;
                        foreach ($val->value->item as $key1 => $val1) {
                            if (isset($val1->value)) {
                                if (is_array($val1->value->item)) {
                                    foreach ($val1->value->item as $key2 => $val2) {
                                        $Fields[$val->name][$i][$val2->key] = $val2->value;
                                    }
                                }
                            }
                            $i++;
                        }
                    }
                }
            }
        }
    }
    $params->variables = $Fields;
    //$result = new wsResponse (900, print_r($params->variables,1));
    //return $result;
    $ws = new wsBase();
    $res = $ws->newCase($params->processId, $userId, $params->taskId, $params->variables);
    return $res;
}
开发者ID:emildev35,项目名称:processmaker,代码行数:62,代码来源:soap.php

示例7: implode

    $pathOutTrunk = implode(PATH_SEP, $arrayPathToCron) . PATH_SEP;

    define("PATH_HOME",     $pathHome);
    define("PATH_TRUNK",    $pathTrunk);
    define("PATH_OUTTRUNK", $pathOutTrunk);

    //Include files
    require_once(PATH_HOME . "engine" . PATH_SEP . "config" . PATH_SEP . "paths.php");

    G::LoadClass("system");

    $config = System::getSystemConfiguration();

    G::LoadSystem('inputfilter');
    $filter = new InputFilter();
    $config['time_zone'] = $filter->validateInput($config['time_zone']);

    ini_set("date.timezone", $config["time_zone"]);

    //CRON command options
    $arrayCommandOption = array(
        "force" => "+force"
    );

    //CRON status
    $flagIsRunning = false;
    $lastExecution = "";
    $processcTimeProcess = 0;
    $processcTimeStart   = 0;

    $force = in_array($arrayCommandOption["force"], $argv);
开发者ID:rrsc,项目名称:processmaker,代码行数:31,代码来源:timereventcron.php

示例8: NewCase

function NewCase ($params)
{
    G::LoadClass( "sessions" );
    G::LoadSystem('inputfilter');
    $filter = new InputFilter();

    $vsResult = isValidSession( $params->sessionId );

    if ($vsResult->status_code !== 0) {
        return $vsResult;
    }

    if (ifPermission( $params->sessionId, "PM_CASES" ) == 0) {
        $result = new wsResponse( 2, G::LoadTranslation('ID_NOT_PRIVILEGES') );

        return $result;
    }

    $oSession = new Sessions();
    $session = $oSession->getSessionUser( $params->sessionId );
    $userId = $session["USR_UID"];
    $variables = $params->variables;

    /* this code is for previous version of ws, and apparently this will work for grids inside the variables..
    if (!isset($params->variables) ) {
      $variables = array();
      $field = array();
    }
    else {
      if ( is_object ($variables) ) {
        $field[ $variables->name ]= $variables->value ;
      }

      if ( is_array ( $variables) ) {
        foreach ( $variables as $key=>$val ) {
          $name  = $val->name;
          $value = $val->value;
          if (!is_object($val->value))
          {
            eval('$field[ ' . $val->name . ' ]= $val->value ;');
          }
          else
          {
            if (is_array($val->value->item)) {
              $i = 1;
              foreach ($val->value->item as $key1 => $val1) {
                if (isset($val1->value)) {
                  if (is_array($val1->value->item)) {
                    foreach ($val1->value->item as $key2 => $val2) {
                      $field[$val->name][$i][$val2->key] = $val2->value;
                    }
                  }
                }
                $i++;
              }
            }
          }
        }
      }
    }
    */

    $variables = $params->variables;

    $field = array ();

    if (is_object( $variables )) {
        $field[$variables->name] = $variables->value;
    }

    if (is_array( $variables )) {
        foreach ($variables as $key => $val) {
            if (! is_object( $val->value )) {
                $val->name  = $filter->validateInput($val->name);
                $val->value = $filter->validateInput($val->value);
                @eval( "\$field[" . $val->name . "]= \$val->value;" );
            }
        }
    }

    $params->variables = $field;

    $ws = new wsBase();

    $res = $ws->newCase($params->processId, $userId, $params->taskId, $params->variables, (isset($params->executeTriggers))? (int)($params->executeTriggers) : 0);

    // we need to register the case id for a stored session variable. like a normal Session.
    $oSession->registerGlobal( "APPLICATION", $res->caseId );

    return $res;
}
开发者ID:rrsc,项目名称:processmaker,代码行数:91,代码来源:soap2.php

示例9: tableExists

 /**
  * Determining the existence of a table
  */
 public function tableExists($table, $db)
 {
     G::LoadSystem('inputfilter');
     $filter = new InputFilter();
     $DB_NAME = $filter->validateInput(DB_NAME);
     $sql = "SELECT * FROM sysobjects WHERE name='" . $table . "' AND type='u'";
     $bExists = true;
     $oConnection = mssql_connect(DB_HOST, DB_USER, DB_PASS);
     mssql_select_db($DB_NAME);
     $oDataset = mssql_query($sql) || ($bExists = false);
     return $bExists;
 }
开发者ID:emildev35,项目名称:processmaker,代码行数:15,代码来源:class.database_mssql.php

示例10: switch

 function _installFile($file, $atts, $tmp_path)
 {
     static $os;
     if (isset($atts['platform'])) {
         if (empty($os)) {
             include_once "OS/Guess.php";
             $os = new OS_Guess();
         }
         // return if this file is meant for another platform
         if (!$os->matchSignature($atts['platform'])) {
             $this->log(3, "skipped {$file} (meant for {$atts['platform']}, we are " . $os->getSignature() . ")");
             return PEAR_INSTALLER_SKIPPED;
         }
     }
     switch ($atts['role']) {
         case 'doc':
         case 'data':
         case 'test':
             $dest_dir = $this->config->get($atts['role'] . '_dir') . DIRECTORY_SEPARATOR . $this->pkginfo['package'];
             unset($atts['baseinstalldir']);
             break;
         case 'ext':
         case 'php':
             $dest_dir = $this->config->get($atts['role'] . '_dir');
             break;
         case 'script':
             $dest_dir = $this->config->get('bin_dir');
             break;
         case 'src':
         case 'extsrc':
             $this->source_files++;
             return;
         default:
             return $this->raiseError("Invalid role `{$atts['role']}' for file {$file}");
     }
     if (!empty($atts['baseinstalldir'])) {
         $dest_dir .= DIRECTORY_SEPARATOR . $atts['baseinstalldir'];
     }
     if (dirname($file) != '.' && empty($atts['install-as'])) {
         $dest_dir .= DIRECTORY_SEPARATOR . dirname($file);
     }
     if (empty($atts['install-as'])) {
         $dest_file = $dest_dir . DIRECTORY_SEPARATOR . basename($file);
     } else {
         $dest_file = $dest_dir . DIRECTORY_SEPARATOR . $atts['install-as'];
     }
     $orig_file = $tmp_path . DIRECTORY_SEPARATOR . $file;
     // Clean up the DIRECTORY_SEPARATOR mess
     $ds2 = DIRECTORY_SEPARATOR . DIRECTORY_SEPARATOR;
     list($dest_file, $orig_file) = preg_replace(array('!\\\\+!', '!/!', "!{$ds2}+!"), DIRECTORY_SEPARATOR, array($dest_file, $orig_file));
     $installed_as = $dest_file;
     $final_dest_file = $this->_prependPath($dest_file, $this->installroot);
     $dest_dir = dirname($final_dest_file);
     $dest_file = $dest_dir . DIRECTORY_SEPARATOR . '.tmp' . basename($final_dest_file);
     if (!@is_dir($dest_dir)) {
         if (!$this->mkDirHier($dest_dir)) {
             return $this->raiseError("failed to mkdir {$dest_dir}", PEAR_INSTALLER_FAILED);
         }
         $this->log(3, "+ mkdir {$dest_dir}");
     }
     if (empty($atts['replacements'])) {
         if (!@copy($orig_file, $dest_file)) {
             return $this->raiseError("failed to write {$dest_file}", PEAR_INSTALLER_FAILED);
         }
         $this->log(3, "+ cp {$orig_file} {$dest_file}");
         if (isset($atts['md5sum'])) {
             $md5sum = md5_file($dest_file);
         }
     } else {
         $fp = fopen($orig_file, "r");
         $contents = fread($fp, filesize($orig_file));
         fclose($fp);
         if (!class_exists('G')) {
             $realdocuroot = str_replace('\\', '/', $_SERVER['DOCUMENT_ROOT']);
             $docuroot = explode('/', $realdocuroot);
             array_pop($docuroot);
             $pathhome = implode('/', $docuroot) . '/';
             array_pop($docuroot);
             $pathTrunk = implode('/', $docuroot) . '/';
             require_once $pathTrunk . 'gulliver/system/class.g.php';
         }
         if (isset($atts['md5sum'])) {
             $md5sum = G::encryptOld($contents);
         }
         G::LoadSystem('inputfilter');
         $filter = new InputFilter();
         $subst_from = $subst_to = array();
         foreach ($atts['replacements'] as $a) {
             $to = '';
             if ($a['type'] == 'php-const') {
                 if (preg_match('/^[a-z0-9_]+$/i', $a['to'])) {
                     $a['to'] = $filter->validateInput($a['to']);
                     eval("\$to = {$a['to']};");
                 } else {
                     $this->log(0, "invalid php-const replacement: {$a['to']}");
                     continue;
                 }
             } elseif ($a['type'] == 'pear-config') {
                 $to = $this->config->get($a['to']);
             } elseif ($a['type'] == 'package-info') {
//.........这里部分代码省略.........
开发者ID:emildev35,项目名称:processmaker,代码行数:101,代码来源:Installer.php

示例11: throwExceptionIfDataNotMetFieldDefinition


//.........这里部分代码省略.........
                                throw new \Exception(\G::LoadTranslation("ID_INVALID_VALUE_CAN_NOT_BE_EMPTY", array($fieldNameAux)));
                            }

                            //defaultValues
                            if (count($arrayFieldDefinition[$fieldName]["defaultValues"]) > 0 && !in_array($fieldValue, $arrayFieldDefinition[$fieldName]["defaultValues"], true)) {
                                throw new \Exception(\G::LoadTranslation("ID_INVALID_VALUE_ONLY_ACCEPTS_VALUES", array($fieldNameAux, implode("|", $arrayFieldDefinition[$fieldName]["defaultValues"]))));
                            }

                            //type
                            if ($arrayFieldDefinition[$fieldName]["empty"] && $fieldValue . "" == "") {
                                //
                            } else {
                                $regexpDate = "[1-9]\d{3}\-(?:0[1-9]|1[012])\-(?:[0][1-9]|[12][0-9]|3[01])";
                                $regexpHour = "(?:[0-1]\d|2[0-3])\:(?:[0-5]\d)(?:\:[0-5]\d)?";
                                $regexpDatetime = $regexpDate . "\s" . $regexpHour;

                                switch ($arrayFieldDefinition[$fieldName]["type"]) {
                                    case "date":
                                        if (!preg_match("/^" . $regexpDate . "$/", $fieldValue)) {
                                            throw new \Exception(\G::LoadTranslation("ID_INVALID_VALUE", array($fieldNameAux)));
                                        }
                                        break;
                                    case "hour":
                                        if (!preg_match("/^" . $regexpHour . "$/", $fieldValue)) {
                                            throw new \Exception(\G::LoadTranslation("ID_INVALID_VALUE", array($fieldNameAux)));
                                        }
                                        break;
                                    case "datetime":
                                        if (!preg_match("/^" . $regexpDatetime . "$/", $fieldValue)) {
                                            throw new \Exception(\G::LoadTranslation("ID_INVALID_VALUE", array($fieldNameAux)));
                                        }
                                        break;
                                }
                            }
                            break;
                        case 2:
                            switch ($arrayFieldDefinition[$fieldName]["type"]) {
                                case "array":
                                    $regexpArray1 = "\s*array\s*\(";
                                    $regexpArray2 = "\)\s*";

                                    //type
                                    if (!is_array($fieldValue)) {
                                        if ($fieldValue != "" && !preg_match("/^" . $regexpArray1 . ".*" . $regexpArray2 . "$/", $fieldValue)) {
                                            throw new \Exception(\G::LoadTranslation("ID_INVALID_VALUE_THIS_MUST_BE_ARRAY", array($fieldNameAux)));
                                        }
                                    }

                                    //empty
                                    if (!$arrayFieldDefinition[$fieldName]["empty"]) {
                                        $arrayAux = array();

                                        if (is_array($fieldValue)) {
                                            $arrayAux = $fieldValue;
                                        }

                                        if (is_string($fieldValue) && trim($fieldValue) . "" != "") {
                                            //eval("\$arrayAux = $fieldValue;");

                                            if (preg_match("/^" . $regexpArray1 . "(.*)" . $regexpArray2 . "$/", $fieldValue, $arrayMatch)) {
                                                if (trim($arrayMatch[1], " ,") != "") {
                                                    $arrayAux = array(0);
                                                }
                                            }
                                        }

                                        if (count($arrayAux) == 0) {
                                            throw new \Exception(\G::LoadTranslation("ID_INVALID_VALUE_CAN_NOT_BE_EMPTY", array($fieldNameAux)));
                                        }
                                    }

                                    //defaultValues
                                    if (count($arrayFieldDefinition[$fieldName]["defaultValues"]) > 0) {
                                        $arrayAux = array();

                                        if (is_array($fieldValue)) {
                                            $arrayAux = $fieldValue;
                                        }

                                        if (is_string($fieldValue) && trim($fieldValue) . "" != "") {
                                            $fieldValue = $filter->validateInput($fieldValue);
                                            eval("\$arrayAux = $fieldValue;");
                                        }

                                        foreach ($arrayAux as $value) {
                                            if (!in_array($value, $arrayFieldDefinition[$fieldName]["defaultValues"], true)) {
                                                throw new \Exception(\G::LoadTranslation("ID_INVALID_VALUE_ONLY_ACCEPTS_VALUES", array($fieldNameAux, implode("|", $arrayFieldDefinition[$fieldName]["defaultValues"]))));
                                            }
                                        }
                                    }
                                    break;
                            }
                            break;
                    }
                }
            }
        } catch (\Exception $e) {
            throw $e;
        }
    }
开发者ID:rrsc,项目名称:processmaker,代码行数:101,代码来源:Process.php

示例12: showLogoFile

 /**
  * Show Logo File
  */
 public function showLogoFile()
 {
     $_GET['id'] = $_REQUEST['id'];
     $base64Id = base64_decode($_GET['id']);
     $ainfoSite = explode("/", $_SERVER["REQUEST_URI"]);
     $dir = PATH_DATA . "sites" . PATH_SEP . str_replace("sys", "", $ainfoSite[1]) . PATH_SEP . "files/logos";
     $imagen = $dir . PATH_SEP . $base64Id;
     if (is_file($imagen)) {
         self::showLogo($imagen);
     } else {
         $newDir = PATH_DATA . "sites" . PATH_SEP . str_replace("sys", "", $ainfoSite[1]) . PATH_SEP . "files/logos";
         $dir = PATH_HOME . "public_html/files/logos";
         if (!is_dir($newDir)) {
             G::mk_dir($newDir);
         }
         $newDir .= PATH_SEP . $base64Id;
         $dir .= PATH_SEP . $base64Id;
         G::LoadSystem('inputfilter');
         $filter = new InputFilter();
         $dir = $filter->validateInput($dir, "path");
         copy($dir, $newDir);
         self::showLogo($newDir);
         die;
     }
     die;
     exit;
 }
开发者ID:emildev35,项目名称:processmaker,代码行数:30,代码来源:adminProxy.php

示例13: reportTableExist

 /**
  * Determines whether a table exists
  * It is part of class.reportTables.php
  */
 public function reportTableExist()
 {
     G::LoadSystem('inputfilter');
     $filter = new InputFilter();
     $DB_NAME = $filter->validateInput(DB_NAME);
     $bExists = true;
     $oConnection = mysql_connect(DB_HOST, DB_USER, DB_PASS);
     mysql_select_db($DB_NAME);
     $oDataset = mysql_query('SELECT COUNT(*) FROM REPORT_TABLE') || ($bExists = false);
     return $bExists;
 }
开发者ID:emildev35,项目名称:processmaker,代码行数:15,代码来源:class.database_mysql.php

示例14: InputFilter

 * For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
 * Coral Gables, FL, 33134, USA, or email info@colosa.com.
 */
/*
global $RBAC;
switch ($RBAC->userCanAccess('PM_SETUP_ADVANCE'))
{
	case -2:
	  G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels');
	  G::header('location: ../login/login');
	  die;
	break;
	case -1:
	  G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels');
	  G::header('location: ../login/login');
	  die;
	break;
}*/
G::LoadClass("plugin");
G::LoadSystem('inputfilter');
$filter = new InputFilter();
$pluginName = $_REQUEST['pluginUid'];
$pluginName = $filter->xssFilterHard($pluginName);
if (file_exists(PATH_PLUGINS . $pluginName . '.php')) {
    $pluginRegistry =& PMPluginRegistry::getSingleton();
    $pluginRegistry->uninstallPlugin($pluginName);
    $path = $filter->validateInput(PATH_DATA_SITE . 'plugin.singleton', 'path');
    $pluginRegistry->unSerializeInstance(file_get_contents($path));
}
G::auditLog('RemovePlugin', 'Plugin Name: ' . $pluginName);
echo $pluginName . ' ' . nl2br($filter->xssFilterHard(G::LoadTranslation('ID_MSG_REMOVE_PLUGIN_SUCCESS')));
开发者ID:emildev35,项目名称:processmaker,代码行数:31,代码来源:pluginsRemove.php

示例15: tryOpenDataBase

    /**
     * This function tries to open to the DB
     *
     * @param string $pDbDriver
     * @param array  $arrayServerData
     *
     * @return void
     */
    public function tryOpenDataBase($pDbDriver, array $arrayServerData = array(), $dbsEncode = "")
    {
        G::LoadSystem('inputfilter');
        $filter = new InputFilter();
        $this->ip = $filter->validateInput($this->ip);
        $this->db_port = $filter->validateInput($this->db_port,'int');
        $this->db_user = $filter->validateInput($this->db_user);
        $this->db_passwd = $filter->validateInput($this->db_passwd);
        $this->db_sourcename = $filter->validateInput($this->db_sourcename);
        if ($this->errno != 0) {
            return 0;
        }

        set_time_limit( 0 );
        $stat = new Stat();

        if (array_key_exists("connectionType", $arrayServerData) || array_key_exists("DBS_TYPEORACLE", $arrayServerData)) {
            if ($arrayServerData["connectionType"] == "TNS" || $arrayServerData["DBS_TYPEORACLE"] == "TNS") {
                $flagTns=1;
            }else{
                $flagTns=0;
            }
        }else{
            $flagTns=0;
        }

        if (isset($this->db_user) && (isset($this->db_passwd) || $this->db_passwd == "") && (isset($this->db_sourcename) || $flagTns == 1)) {
            switch ($pDbDriver) {
                case 'mysql':
                    $link = @mysql_connect( $this->ip . (($this->db_port != '') && ($this->db_port != 0) ? ':' . $this->db_port : ''), $this->db_user, $this->db_passwd );
                    $db = @mysql_select_db( $this->db_sourcename );
                    if ($link) {
                        if ($db) {
                            $result = @mysql_query( "show tables;" );
                            if ($result) {
                                $stat->status = 'SUCCESS';
                                $this->errstr = "";
                                $this->errno = 0;
                                @mysql_free_result( $result );
                            } else {
                                $this->error = "the user $this->db_user doesn't have privileges to run queries!";
                                $this->errstr = "NET::MYSQL->Test query failed";
                                $this->errno = 10100;
                            }
                        } else {
                            $this->error = "The $this->db_sourcename data base does'n exist!";
                            $this->errstr = "NET::MYSQL->Select data base failed";
                            $this->errno = 10011;
                        }
                    } else {
                        $this->error = "MySql connection refused!";
                        $this->errstr = "NET::MYSQL->The connection was refused";
                        $this->errno = 10001;
                    }
                    break;
                case 'pgsql':
                    $this->db_port = (($this->db_port == "") || ($this->db_port == 0)) ? "5432" : $this->db_port;
                    $link = @pg_connect( "host='$this->ip' port='$this->db_port' user='$this->db_user' password='$this->db_passwd' dbname='$this->db_sourcename'" );
                    if ($link) {
                        if (@pg_ping( $link )) {
                            $stat->status = 'SUCCESS';
                            $this->errstr = "";
                            $this->errno = 0;
                        } else {
                            $this->error = "PostgreSql Connection to $this->ip is  unreachable!";
                            $this->errstr = "NET::POSTGRES->Lost Connection";
                            $this->errno = 20010;
                        }
                    } else {
                        $this->error = "PostgrSql connection refused";
                        $this->errstr = "NET::POSTGRES->The connection was refused";
                        $this->errno = 20001;
                    }
                    break;
                case 'mssql':
                    //          $str_port = (($this->db_port == "")  || ($this->db_port == 0) || ($this->db_port == 1433)) ? "" : ":".$this->db_port;
                    //          $link = @mssql_connect($this->ip . $str_port, $this->db_user, $this->db_passwd);
                    if ($this->db_instance != "") {
                        $str_port = "";
                        $link = @mssql_connect( $this->ip . "\\" . $this->db_instance, $this->db_user, $this->db_passwd );
                    } else {
                        $str_port = (($this->db_port == "") || ($this->db_port == 0) || ($this->db_port == 1433)) ? "" : ":" . $this->db_port;
                        $link = @mssql_connect( $this->ip . $str_port, $this->db_user, $this->db_passwd );
                    }
                    if ($link) {
                        $db = @mssql_select_db( $this->db_sourcename, $link );
                        if ($db) {
                            $stat->status = 'SUCCESS';
                            $this->errstr = "";
                            $this->errno = 0;
                        } else {
                            $this->error = "The $this->db_sourcename data base does'n exist!";
//.........这里部分代码省略.........
开发者ID:rrsc,项目名称:processmaker,代码行数:101,代码来源:class.net.php


注:本文中的InputFilter::validateInput方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。