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


PHP G::json_decode方法代码示例

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


在下文中一共展示了G::json_decode方法的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: install

function install($file)
{
    G::LoadThirdParty("pear/Archive", "Tar");
    $result = array();
    $status = 1;
    try {
        //Extract
        $tar = new Archive_Tar($file);
        $swTar = $tar->extract(PATH_OUTTRUNK);
        //true on success, false on error. //directory for extract
        //$swTar = $tar->extract(PATH_PLUGINS);
        if (!$swTar) {
            throw new Exception("Could not extract file.");
        }
        //Upgrade
        $option = array("http" => array("method" => "POST"));
        // Proxy settings
        $sysConf = System::getSystemConfiguration();
        if (isset($sysConf['proxy_host'])) {
            if ($sysConf['proxy_host'] != '') {
                if (!is_array($option['http'])) {
                    $option['http'] = array();
                }
                $option['http']['request_fulluri'] = true;
                $option['http']['proxy'] = 'tcp://' . $sysConf['proxy_host'] . ($sysConf['proxy_port'] != '' ? ':' . $sysConf['proxy_port'] : '');
                if ($sysConf['proxy_user'] != '') {
                    if (!isset($option['http']['header'])) {
                        $option['http']['header'] = '';
                    }
                    $option['http']['header'] .= 'Proxy-Authorization: Basic ' . base64_encode($sysConf['proxy_user'] . ($sysConf['proxy_pass'] != '' ? ':' . $sysConf['proxy_pass'] : ''));
                }
            }
        }
        $context = stream_context_create($option);
        ///////
        $fileData = @fopen(EnterpriseUtils::getUrlServerName() . "/sys" . SYS_SYS . "/" . SYS_LANG . "/" . SYS_SKIN . "/enterprise/services/processMakerUpgrade", "rb", false, $context);
        if ($fileData === false) {
            throw new Exception("Could not open services url.");
        }
        $resultAux = G::json_decode(stream_get_contents($fileData));
        if ($resultAux->status == "OK") {
            $result["status"] = $resultAux->status;
            //OK
            $result["message"] = $resultAux->message;
        } else {
            throw new Exception($resultAux->message);
        }
    } catch (Exception $e) {
        $result["message"] = $e->getMessage();
        $status = 0;
    }
    if ($status == 0) {
        $result["status"] = "ERROR";
    }
    return $result;
}
开发者ID:emildev35,项目名称:processmaker,代码行数:56,代码来源:processMakerAjax.php

示例3: letsRestore

    static public function letsRestore ($filename, $srcWorkspace, $dstWorkspace = null, $overwrite = true)
    {
        // Needed info:
        // TEMPDIR  /shared/workflow_data/upgrade/
        // BACKUPS  /shared/workflow_data/backups/
        // Creating command  cat myfiles_split.tgz_* | tar xz
        $DecommpressCommand = "cat " . $filename . ".* ";
        $DecommpressCommand .= " | tar xzv";

        $tempDirectory = PATH_DATA . "upgrade/" . basename( tempnam( __FILE__, '' ) );
        $parentDirectory = PATH_DATA . "upgrade";
        if (is_writable( $parentDirectory )) {
            mkdir( $tempDirectory );
        } else {
            throw new Exception( "Could not create directory:" . $parentDirectory );
        }
        //Extract all backup files, including database scripts and workspace files
        CLI::logging( "Restoring into " . $tempDirectory . "\n" );
        chdir( $tempDirectory );
        echo exec( $DecommpressCommand );
        CLI::logging( "\nUncompressed into: " . $tempDirectory . "\n" );

        //Search for metafiles in the new standard (the old standard would contain meta files.
        $metaFiles = glob( $tempDirectory . "/*.meta" );
        if (empty( $metaFiles )) {
            $metaFiles = glob( $tempDirectory . "/*.txt" );
            if (! empty( $metaFiles )) {
                return workspaceTools::restoreLegacy( $tempDirectory );
            } else {
                throw new Exception( "No metadata found in backup" );
            }
        } else {
            CLI::logging( "Found " . count( $metaFiles ) . " workspaces in backup:\n" );
            foreach ($metaFiles as $metafile) {
                CLI::logging( "-> " . basename( $metafile ) . "\n" );
            }
        }
        if (count( $metaFiles ) > 1 && (! isset( $srcWorkspace ))) {
            throw new Exception( "Multiple workspaces in backup but no workspace specified to restore" );
        }
        if (isset( $srcWorkspace ) && ! in_array( "$srcWorkspace.meta", array_map( basename, $metaFiles ) )) {
            throw new Exception( "Workspace $srcWorkspace not found in backup" );
        }
        foreach ($metaFiles as $metaFile) {
            $metadata = G::json_decode( file_get_contents( $metaFile ) );
            if ($metadata->version != 1) {
                throw new Exception( "Backup version {$metadata->version} not supported" );
            }
            $backupWorkspace = $metadata->WORKSPACE_NAME;
            if (isset( $dstWorkspace )) {
                $workspaceName = $dstWorkspace;
                $createWorkspace = true;
            } else {
                $workspaceName = $metadata->WORKSPACE_NAME;
                $createWorkspace = false;
            }
            if (isset( $srcWorkspace ) && strcmp( $metadata->WORKSPACE_NAME, $srcWorkspace ) != 0) {
                CLI::logging( CLI::warning( "> Workspace $backupWorkspace found, but not restoring." ) . "\n" );
                continue;
            } else {
                CLI::logging( "> Restoring " . CLI::info( $backupWorkspace ) . " to " . CLI::info( $workspaceName ) . "\n" );
            }
            $workspace = new workspaceTools( $workspaceName );
            if ($workspace->workspaceExists()) {
                if ($overwrite) {
                    CLI::logging( CLI::warning( "> Workspace $workspaceName already exist, overwriting!" ) . "\n" );
                } else {
                    throw new Exception( "Destination workspace already exist (use -o to overwrite)" );
                }
            }
            if (file_exists( $workspace->path )) {
                G::rm_dir( $workspace->path );
            }
            foreach ($metadata->directories as $dir) {
                CLI::logging( "+> Restoring directory '$dir'\n" );
                if (! rename( "$tempDirectory/$dir", $workspace->path )) {
                    throw new Exception( "There was an error copying the backup files ($tempDirectory/$dir) to the workspace directory {$workspace->path}." );
                }
            }

            CLI::logging( "> Changing file permissions\n" );
            $shared_stat = stat( PATH_DATA );
            if ($shared_stat !== false) {
                workspaceTools::dirPerms( $workspace->path, $shared_stat['uid'], $shared_stat['gid'], $shared_stat['mode'] );
            } else {
                CLI::logging( CLI::error( "Could not get the shared folder permissions, not changing workspace permissions" ) . "\n" );
            }

            list ($dbHost, $dbUser, $dbPass) = @explode( SYSTEM_HASH, G::decrypt( HASH_INSTALLATION, SYSTEM_HASH ) );

            CLI::logging( "> Connecting to system database in '$dbHost'\n" );
            $link = mysql_connect( $dbHost, $dbUser, $dbPass );
            @mysql_query( "SET NAMES 'utf8';" );
            @mysql_query( "SET FOREIGN_KEY_CHECKS=0;" );
            if (! $link) {
                throw new Exception( 'Could not connect to system database: ' . mysql_error() );
            }

            $newDBNames = $workspace->resetDBInfo( $dbHost, $createWorkspace );

//.........这里部分代码省略.........
开发者ID:hpx2206,项目名称:processmaker-1,代码行数:101,代码来源:class.multipleFilesBackup.php

示例4: getFacetsList

 /**
  * Execute a query in base to Request data
  *
  * @param Entity_FacetRequest $facetRequestEntity
  * @return solr response: list of facets array
  */
 public function getFacetsList($facetRequest)
 {
     if (!$this->_solrIsEnabled) {
         return;
     }
     $solrIntruct = '';
     // get configuration information in base to workspace parameter
     $workspace = $facetRequest->workspace;
     // format request
     $query = empty($facetRequest->searchText) ? '*:*' : $facetRequest->searchText;
     $query = rawurlencode($query);
     $start = '&start=0';
     $rows = '&rows=0';
     $facets = '&facet=on&facet.mincount=1&facet.limit=20';
     // enable facet and
     // only return facets
     // with minimun one
     // instance
     foreach ($facetRequest->facetFields as $value) {
         $facets .= '&facet.field=' . $value;
     }
     foreach ($facetRequest->facetQueries as $value) {
         $facets .= '&facet.query=' . $value;
     }
     if (!empty($facetRequest->facetDates)) {
         foreach ($facetRequest->facetDates as $value) {
             $facets .= '&facet.date=' . $value;
         }
         $facets .= '&facet.date.start=' . $facetRequest->facetDatesStart;
         $facets .= '&facet.date.end=' . $facetRequest->facetDatesEnd;
         $facets .= '&facet.date.gap=' . $facetRequest->facetDateGap;
     }
     $filters = '';
     foreach ($facetRequest->filters as $value) {
         $filters .= '&fq=' . $value;
     }
     // echo "<pre>";
     $resultFormat = '&wt=json';
     $solrIntruct = substr($this->_solrHost, -1) == "/" ? $this->_solrHost : $this->_solrHost . "/";
     $solrIntruct .= $workspace;
     $solrIntruct .= "/select/?q={$query}";
     $solrIntruct .= "&echoParams=none";
     $solrIntruct .= self::SOLR_VERSION;
     $solrIntruct .= $start;
     $solrIntruct .= $rows;
     $solrIntruct .= $facets;
     $solrIntruct .= $filters;
     $solrIntruct .= $resultFormat;
     // send query
     // search the cases in base to datatable parameters
     $handler = curl_init($solrIntruct);
     curl_setopt($handler, CURLOPT_RETURNTRANSFER, true);
     //Apply proxy settings
     $sysConf = System::getSystemConfiguration();
     if ($sysConf['proxy_host'] != '') {
         curl_setopt($handler, CURLOPT_PROXY, $sysConf['proxy_host'] . ($sysConf['proxy_port'] != '' ? ':' . $sysConf['proxy_port'] : ''));
         if ($sysConf['proxy_port'] != '') {
             curl_setopt($handler, CURLOPT_PROXYPORT, $sysConf['proxy_port']);
         }
         if ($sysConf['proxy_user'] != '') {
             curl_setopt($handler, CURLOPT_PROXYUSERPWD, $sysConf['proxy_user'] . ($sysConf['proxy_pass'] != '' ? ':' . $sysConf['proxy_pass'] : ''));
         }
         curl_setopt($handler, CURLOPT_HTTPHEADER, array('Expect:'));
     }
     $response = curl_exec($handler);
     curl_close($handler);
     // decode
     $responseSolr = G::json_decode($response);
     if ($responseSolr->responseHeader->status != 0) {
         throw new Exception("Error getting faceted list from Solr." . $solrIntruct . " response error: " . $response . "\n");
     }
     return $responseSolr;
 }
开发者ID:rodrigoivan,项目名称:processmaker,代码行数:79,代码来源:class.solr.php

示例5: testJson_decode

 /**
  * @covers G::json_decode
  * @todo   Implement testJson_decode().
  */
 public function testJson_decode()
 {
     $jsonTest = '{"pos1":"value1","pos2":"value2","pos3":"value3"}';
     $response = G::json_decode($jsonTest);
     $this->assertEquals($response->pos1, 'value1');
     $this->assertEquals($response->pos2, 'value2');
     $this->assertEquals($response->pos3, 'value3');
 }
开发者ID:emildev35,项目名称:processmaker,代码行数:12,代码来源:GTest.php

示例6: getDWSDocumentVersions

/**
 *
 * @method Get DWS Document Versions
 *
 * @name getDWSDocumentVersions
 * @label Get DWS Document Versions
 *
 * @param string | $sharepointServer | Server name and port whre DWS wsdl exists, including protocol | http://server:port/_vti_bin/Dws.asmx?WSDL
 * @param string | $auth | Valid Auth string to connect to server | user:password
 * @param string | $newFileName | Name of New File
 * @param string | $dwsname | Name of DWS
 *
 * @return string | $result | Response
 *
 */
function getDWSDocumentVersions($sharepointServer, $auth, $newFileName, $dwsname)
{
    require_once PATH_CORE . 'classes' . PATH_SEP . 'triggers' . PATH_SEP . 'class.pmTrSharepoint.php';
    $pmTrSharepoint = new pmTrSharepointClass($sharepointServer, $auth);
    $result = $pmTrSharepoint->getDWSDocumentVersions($newFileName, $dwsname);
    if (isset($result->GetVersionsResult)) {
        /*
         * Code to get the Document's Version/s
         */
        $xml = $result->GetVersionsResult->any;
        // in Result we get string in Xml format
        $xmlNew = simplexml_load_string($xml);
        // used to parse string to xml
        $xmlArray = @G::json_decode(@G::json_encode($xmlNew), 1);
        // used to convert Objects to array
        $resultCount = count($xmlArray['result']);
        for ($i = 0; $i < $resultCount; $i++) {
            $version[] = $xmlArray['result'][$i]['@attributes']['version'];
        }
        $serializeResult = serialize($version);
        // serializing the Array for Returning.
        return $serializeResult;
    } else {
        return "No version found";
    }
}
开发者ID:rodrigoivan,项目名称:processmaker,代码行数:41,代码来源:class.pmSharepointFunctions.php

示例7: sendActionsByEmail


//.........这里部分代码省略.........
                        } catch (Exception $error) {
                            throw $error;
                        }

                        if ($configuration['ABE_TYPE'] != '') {
                            // Email
                            $_SESSION['CURRENT_DYN_UID'] = $configuration['DYN_UID'];

                            $scriptCode = '';
//                            foreach ($dynaform->fields as $fieldName => $field) {
//                                if ($field->type == 'submit') {
//                                    unset($dynaform->fields[$fieldName]);
//                                }
//                            }

                            $__ABE__ = '';
                            $link = (G::is_https() ? 'https://' : 'http://') . $_SERVER['HTTP_HOST'] . '/sys' . SYS_SYS . '/' . SYS_LANG . '/' . SYS_SKIN . '/services/ActionsByEmail';

                            switch ($configuration['ABE_TYPE']) {
                                case 'LINK':
                                    // $__ABE__ .= $dynaform->render(PATH_FEATURES . 'actionsByEmail/xmlform.html', $scriptCode) . '<br />';
                                    $__ABE__ .= '<a href="' . $link . 'DataForm?APP_UID=' . G::encrypt($data->APP_UID, URL_KEY) . '&DEL_INDEX=' . G::encrypt($data->DEL_INDEX, URL_KEY) . '&DYN_UID=' . G::encrypt($configuration['DYN_UID'], URL_KEY) . '&ABER=' . G::encrypt($abeRequest['ABE_REQ_UID'], URL_KEY) . '" target="_blank">Please complete this form</a>';
                                    break;
                                // coment
                                case 'FIELD':
                                        $variableService = new \ProcessMaker\Services\Api\Project\Variable();
                                        $variables = $variableService->doGetVariables($caseFields['PRO_UID']);
                                        $field = new stdClass();
                                        $field->label = 'Test';
                                        $field->type = 'dropdown';
                                        $field->options = array();
                                        $actionField = str_replace('@@', '', $configuration['ABE_ACTION_FIELD']);
                                        $dynaform = $configuration['DYN_UID'];
                                        $variables = G::json_decode($configuration['DYN_CONTENT'], true);
                                        if(isset($variables['items'][0]['items'])){
                                            $fields = $variables['items'][0]['items'];
                                            foreach ($fields as $key => $value) {
                                                foreach($value as $var){ G::pr($var);
                                                    if(isset($var['variable'])){
                                                        if ($var['variable'] == $actionField) {
                                                             $field->label = $var['label'];
                                                             $field->type  = $var['type'];
                                                             $values = $var['options'];
                                                             foreach ($values as $val){
                                                               $field->options[$val['value']] = $val['value'];
                                                             }
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                        G::LoadClass('pmDynaform');
                                        $obj = new pmDynaform($configuration['DYN_UID']);
                                        $configuration['CURRENT_DYNAFORM'] = $configuration['DYN_UID'];
                                        $file = $obj->printPmDynaformAbe($configuration);
                                        $__ABE__ .= $file;
                                        $__ABE__ .= '<strong>' . $field->label . '</strong><br /><table align="left" border="0"><tr>';
                                        switch ($field->type) {
                                            case 'dropdown':
                                            case 'radiogroup':
                                                $index = 1;
                                                $__ABE__.='<br /><td><table align="left" cellpadding="2"><tr>';
                                                foreach ($field->options as $optValue => $optName) {
                                                    $__ABE__ .= '<td align="center"><a style="text-decoration: none; color: #000; background-color: #E5E5E5; ';
                                                    $__ABE__ .= 'filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#EFEFEF, endColorstr=#BCBCBC); ';
                                                    $__ABE__ .= 'background-image: -webkit-gradient(linear, left top, left bottom, from(#EFEFEF), #BCBCBC); ';
开发者ID:hpx2206,项目名称:processmaker-1,代码行数:67,代码来源:class.actionsByEmailCore.php

示例8: restore

 /**
  * restore an archive into a workspace
  *
  * Restores any database and files included in the backup, either as a new
  * workspace, or overwriting a previous one
  *
  * @param string $filename the backup filename
  * @param string $newWorkspaceName if defined, supplies the name for the
  * workspace to restore to
  */
 public static function restore($filename, $srcWorkspace, $dstWorkspace = null, $overwrite = true)
 {
     G::LoadThirdParty('pear/Archive', 'Tar');
     $backup = new Archive_Tar($filename);
     //Get a temporary directory in the upgrade directory
     $tempDirectory = PATH_DATA . "upgrade/" . basename(tempnam(__FILE__, ''));
     $parentDirectory = PATH_DATA . "upgrade";
     if (is_writable($parentDirectory)) {
         mkdir($tempDirectory);
     } else {
         throw new Exception("Could not create directory:" . $parentDirectory);
     }
     //Extract all backup files, including database scripts and workspace files
     if (!$backup->extract($tempDirectory)) {
         throw new Exception("Could not extract backup");
     }
     //Search for metafiles in the new standard (the old standard would contain
     //txt files).
     $metaFiles = glob($tempDirectory . "/*.meta");
     if (empty($metaFiles)) {
         $metaFiles = glob($tempDirectory . "/*.txt");
         if (!empty($metaFiles)) {
             return workspaceTools::restoreLegacy($tempDirectory);
         } else {
             throw new Exception("No metadata found in backup");
         }
     } else {
         CLI::logging("Found " . count($metaFiles) . " workspaces in backup:\n");
         foreach ($metaFiles as $metafile) {
             CLI::logging("-> " . basename($metafile) . "\n");
         }
     }
     if (count($metaFiles) > 1 && !isset($srcWorkspace)) {
         throw new Exception("Multiple workspaces in backup but no workspace specified to restore");
     }
     if (isset($srcWorkspace) && !in_array("{$srcWorkspace}.meta", array_map(BASENAME, $metaFiles))) {
         throw new Exception("Workspace {$srcWorkspace} not found in backup");
     }
     foreach ($metaFiles as $metaFile) {
         $metadata = G::json_decode(file_get_contents($metaFile));
         if ($metadata->version != 1) {
             throw new Exception("Backup version {$metadata->version} not supported");
         }
         $backupWorkspace = $metadata->WORKSPACE_NAME;
         if (isset($dstWorkspace)) {
             $workspaceName = $dstWorkspace;
             $createWorkspace = true;
         } else {
             $workspaceName = $metadata->WORKSPACE_NAME;
             $createWorkspace = false;
         }
         if (isset($srcWorkspace) && strcmp($metadata->WORKSPACE_NAME, $srcWorkspace) != 0) {
             CLI::logging(CLI::warning("> Workspace {$backupWorkspace} found, but not restoring.") . "\n");
             continue;
         } else {
             CLI::logging("> Restoring " . CLI::info($backupWorkspace) . " to " . CLI::info($workspaceName) . "\n");
         }
         $workspace = new workspaceTools($workspaceName);
         if ($workspace->workspaceExists()) {
             if ($overwrite) {
                 CLI::logging(CLI::warning("> Workspace {$workspaceName} already exist, overwriting!") . "\n");
             } else {
                 throw new Exception("Destination workspace already exist (use -o to overwrite)");
             }
         }
         if (file_exists($workspace->path)) {
             G::rm_dir($workspace->path);
         }
         foreach ($metadata->directories as $dir) {
             CLI::logging("+> Restoring directory '{$dir}'\n");
             if (!rename("{$tempDirectory}/{$dir}", $workspace->path)) {
                 throw new Exception("There was an error copying the backup files ({$tempDirectory}/{$dir}) to the workspace directory {$workspace->path}.");
             }
         }
         CLI::logging("> Changing file permissions\n");
         $shared_stat = stat(PATH_DATA);
         if ($shared_stat !== false) {
             workspaceTools::dirPerms($workspace->path, $shared_stat['uid'], $shared_stat['gid'], $shared_stat['mode']);
         } else {
             CLI::logging(CLI::error("Could not get the shared folder permissions, not changing workspace permissions") . "\n");
         }
         list($dbHost, $dbUser, $dbPass) = @explode(SYSTEM_HASH, G::decrypt(HASH_INSTALLATION, SYSTEM_HASH));
         CLI::logging("> Connecting to system database in '{$dbHost}'\n");
         $link = mysql_connect($dbHost, $dbUser, $dbPass);
         @mysql_query("SET NAMES 'utf8';");
         @mysql_query("SET FOREIGN_KEY_CHECKS=0;");
         if (!$link) {
             throw new Exception('Could not connect to system database: ' . mysql_error());
         }
         $newDBNames = $workspace->resetDBInfo($dbHost, $createWorkspace);
//.........这里部分代码省略.........
开发者ID:rodrigoivan,项目名称:processmaker,代码行数:101,代码来源:class.wsTools.php

示例9: 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 ($variables->name === "__POST_VARIABLES__") {
        $field = G::json_decode($variables->value, true);
        $variables = null;
    }
    if (is_object($variables)) {
        $field[$variables->name] = $variables->value;
    }
    if (is_array($variables)) {
        foreach ($variables as $key => $val) {
            if (!is_object($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:emildev35,项目名称:processmaker,代码行数:78,代码来源:soap2.php

示例10: xssFilterHard

 /** 
  * Internal method: remove malicious code, fix missing end tags, fix illegal nesting, convert deprecated tags, validate CSS, preserve rich formatting 
  * @author Marcelo Cuiza
  * @access protected
  * @param Array or String $input
  * @param String $type (url)
  * @return Array or String $input
  */
 function xssFilterHard($input, $type = "")
 {
     require_once PATH_THIRDPARTY . 'HTMLPurifier/HTMLPurifier.auto.php';
     $config = HTMLPurifier_Config::createDefault();
     $purifier = new HTMLPurifier($config);
     if (is_array($input)) {
         if (sizeof($input)) {
             foreach ($input as $i => $val) {
                 if (is_array($val) || is_object($val) && sizeof($val)) {
                     $input[$i] = $this->xssFilterHard($val);
                 } else {
                     if (!empty($val)) {
                         if (!is_object(G::json_decode($val))) {
                             $inputFiltered = $purifier->purify($val);
                             if ($type != "url" && !strpos(basename($val), "=")) {
                                 $inputFiltered = htmlspecialchars($inputFiltered, ENT_NOQUOTES, 'UTF-8');
                             } else {
                                 $inputFiltered = str_replace('&amp;', '&', $inputFiltered);
                             }
                         } else {
                             $jsArray = G::json_decode($val, true);
                             if (is_array($jsArray) && sizeof($jsArray)) {
                                 foreach ($jsArray as $j => $jsVal) {
                                     if (is_array($jsVal) && sizeof($jsVal)) {
                                         $jsArray[$j] = $this->xssFilterHard($jsVal);
                                     } else {
                                         if (!empty($jsVal)) {
                                             $jsArray[$j] = $purifier->purify($jsVal);
                                         }
                                     }
                                 }
                                 $inputFiltered = G::json_encode($jsArray);
                             } else {
                                 $inputFiltered = $val;
                             }
                         }
                     } else {
                         $inputFiltered = "";
                     }
                     $input[$i] = $inputFiltered;
                 }
             }
         }
         return $input;
     } else {
         if (!isset($input) || empty($input)) {
             return '';
         } else {
             if (is_object($input)) {
                 if (sizeof($input)) {
                     foreach ($input as $j => $jsVal) {
                         if (is_array($jsVal) || is_object($jsVal) && sizeof($jsVal)) {
                             $input->j = $this->xssFilterHard($jsVal);
                         } else {
                             if (!empty($jsVal)) {
                                 $input->j = $purifier->purify($jsVal);
                             }
                         }
                     }
                 }
                 return $input;
             }
             if (!is_object(G::json_decode($input))) {
                 $input = $purifier->purify($input);
                 if ($type != "url" && !strpos(basename($input), "=")) {
                     $input = addslashes(htmlspecialchars($input, ENT_COMPAT, 'UTF-8'));
                 } else {
                     $input = str_replace('&amp;', '&', $input);
                 }
             } else {
                 $jsArray = G::json_decode($input, true);
                 if (is_array($jsArray) && sizeof($jsArray)) {
                     foreach ($jsArray as $j => $jsVal) {
                         if (is_array($jsVal) || is_object($jsVal) && sizeof($jsVal)) {
                             $jsArray[$j] = $this->xssFilterHard($jsVal);
                         } else {
                             if (!empty($jsVal)) {
                                 $jsArray[$j] = $purifier->purify($jsVal);
                             }
                         }
                     }
                     $input = G::json_encode($jsArray);
                 }
             }
             return $input;
         }
     }
 }
开发者ID:emildev35,项目名称:processmaker,代码行数:96,代码来源:class.inputfilter.php

示例11:

 case 'editObjectPermission':
     // we also need the process uid variable for the function.
     $oProcessMap->editObjectPermission($oData->op_uid, $oData->pro_uid);
     break;
 case 'caseTracker':
     $oProcessMap->caseTracker($oData->pro_uid);
     break;
 case 'caseTrackerObjects':
     $oProcessMap->caseTrackerObjects($oData->pro_uid);
     break;
 case 'processFilesManager':
     $_SESSION['PFMDirectory'] = '';
     $oProcessMap->processFilesManager($oData->pro_uid);
     break;
 case 'exploreDirectory':
     $objData = G::json_decode($_REQUEST['data']);
     $_SESSION['PFMDirectory'] = $objData->{'main_directory'};
     $oProcessMap->exploreDirectory($oData->pro_uid, $oData->main_directory, $oData->directory);
     break;
 case 'deleteFile':
     $oProcessMap->deleteFile($oData->pro_uid, $oData->main_directory, $oData->directory, $oData->file);
     break;
 case 'deleteDirectory':
     $oProcessMap->deleteDirectory($oData->pro_uid, $oData->main_directory, $oData->directory, $oData->dir_to_delete);
     break;
 case 'downloadFile':
     $oProcessMap->downloadFile($oData->pro_uid, $oData->main_directory, $oData->directory, $oData->file);
     break;
 case 'deleteSubProcess':
     $sOutput = $oProcessMap->deleteSubProcess($oData->pro_uid, $oData->tas_uid);
     break;
开发者ID:rodriquelca,项目名称:processmaker,代码行数:31,代码来源:processes_Ajax.php

示例12: array

 * it under the terms of the GNU Affero General Public License as
 * published by the Free Software Foundation, either version 3 of the
 * License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
 *
 * For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
 * Coral Gables, FL, 33134, USA, or email info@colosa.com.
 */
$aData = G::json_decode($_POST['data']);
$appSelectedUids = array();
$items = explode(",", $_POST['APP_UIDS']);
foreach ($items as $item) {
    $dataUids = explode("|", $item);
    $appSelectedUids[] = $dataUids[0];
}
// var_dump($aData);
//var_dump($appSelectedUids);
$casesReassignedCount = 0;
$serverResponse = array();
G::LoadClass('case');
$oCases = new Cases();
require_once 'classes/model/Task.php';
require_once 'classes/model/AppCacheView.php';
$oAppCacheView = new AppCacheView();
开发者ID:rodrigoivan,项目名称:processmaker,代码行数:31,代码来源:proxySaveReassignCasesList.php

示例13: InputFilter

<?php

/**
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
G::LoadSystem('inputfilter');
$filter = new InputFilter();
$_POST = $filter->xssFilterHard($_POST);
require_once "classes/model/AdditionalTables.php";
require_once "classes/model/Fields.php";
// passing the parameters
$pmTableName = isset($_POST['tableName']) ? $_POST['tableName'] : 'contenders';
$pmTableFields = isset($_POST['tableFields']) ? G::json_decode($_POST['tableFields']) : array();
// default parameters
//$pmTableName   = 'Sender';
$pmTableFields = array(array('FLD_NAME' => 'APP_UID'), array('FLD_NAME' => 'CON_NAME'), array('FLD_NAME' => 'CON_ADDR'), array('FLD_NAME' => '_cedula'));
// setting the data to assemble the table
$aData = array();
$aData['ADD_TAB_NAME'] = $pmTableName;
// creating the objects to create the table and records
$oFields = new Fields();
$oAdditionalTables = new AdditionalTables();
$sAddTabUid = $oAdditionalTables->create($aData, $pmTableFields);
foreach ($pmTableFields as $iRow => $aRow) {
    $pmTableFields[$iRow]['FLD_NAME'] = strtoupper($aRow['FLD_NAME']);
    $pmTableFields[$iRow]['FLD_DESCRIPTION'] = isset($aRow['FLD_DESCRIPTION']) ? $aRow['FLD_DESCRIPTION'] : $aRow['FLD_NAME'];
    $pmTableFields[$iRow]['FLD_TYPE'] = isset($aRow['FLD_TYPE']) ? $aRow['FLD_TYPE'] : 'VARCHAR';
    $pmTableFields[$iRow]['FLD_SIZE'] = isset($aRow['FLD_SIZE']) ? $aRow['FLD_SIZE'] : '32';
    $pmTableFields[$iRow]['FLD_NULL'] = isset($aRow['FLD_NULL']) ? $aRow['FLD_NULL'] : 'off';
    $pmTableFields[$iRow]['FLD_AUTO_INCREMENT'] = isset($aRow['FLD_AUTO_INCREMENT']) ? $aRow['FLD_AUTO_INCREMENT'] : 'off';
开发者ID:emildev35,项目名称:processmaker,代码行数:31,代码来源:cases_generatePMTable.php

示例14: deleteAllDWSDocVersion

 function deleteAllDWSDocVersion($newFileName, $dwsname)
 {
     //print "<br>- Method createDWS";
     $this->dwsObj->setwsdlurl($this->server . "/" . $dwsname . "/_vti_bin/Versions.asmx?WSDL");
     $this->dwsObj->loadSOAPClient();
     $doc = "Shared Documents/{$newFileName}";
     $paramArray = array('fileName' => $doc);
     $methodName = 'DeleteAllVersions';
     $result = $this->dwsObj->callWsMethod($methodName, $paramArray);
     if ($result) {
         $xml = $result->DeleteAllVersionsResult->any;
         // in Result we get string in Xml format
         $xmlNew = simplexml_load_string($xml);
         // used to parse string to xml
         $xmlArray = @G::json_decode(@G::json_encode($xmlNew), 1);
         // used to convert Objects to array
         $latestVersion = $xmlArray['result']['@attributes']['version'];
         return "All Versions are Deleted, except the latest i.e {$latestVersion}";
     } else {
         return "The Version/ File name/ Dws Name  is incorrect";
     }
 }
开发者ID:nshong,项目名称:processmaker,代码行数:22,代码来源:class.pmTrSharepoint.php

示例15: switch

try {
    global $RBAC;
    switch ($RBAC->userCanAccess('PM_FACTORY')) {
        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;
    }
    //$oJSON = new Services_JSON();
    $aData = get_object_vars(G::json_decode($_POST['oData']));
    //$aData = get_object_vars( $oJSON->decode( $_POST['oData'] ) );
    if (isset($_POST['function'])) {
        $sAction = $_POST['function'];
    } else {
        $sAction = $_POST['functions'];
    }
    switch ($sAction) {
        case "saveTaskData":
            require_once "classes/model/Task.php";
            $response = array();
            $oTask = new Task();
            /**
             * routine to replace @amp@ by &
             * that why the char "&" can't be passed by XmlHttpRequest directly
             * @autor erik <erik@colosa.com>
开发者ID:rodrigoivan,项目名称:processmaker,代码行数:31,代码来源:tasks_Ajax.php


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