コード例 #1
0
 /**
  * sign request data with OAuth
  * 
  * @param array (	"method => signature methos
  * 					"key" => consumer key
  * 					"secret" => shared secret
  * 					"token"	=> request token
  * 					"url" => request url
  * 					data => array (key => value)
  * 				)
  * 						
  * @return array	signed data
  */
 private static function signOAuth($a_params)
 {
     require_once './Customizing/global/plugins/Services/Repository/RepositoryObject/ExternalContent/lib/OAuth.php';
     switch ($a_params['sign_method']) {
         case "HMAC_SHA1":
             $method = new OAuthSignatureMethod_HMAC_SHA1();
             break;
         case "PLAINTEXT":
             $method = new OAuthSignatureMethod_PLAINTEXT();
             break;
         case "RSA_SHA1":
             $method = new OAuthSignatureMethod_RSA_SHA1();
             break;
         default:
             return "ERROR: unsupported signature method!";
     }
     $consumer = new OAuthConsumer($a_params["key"], $a_params["secret"], $a_params["callback"]);
     $request = OAuthRequest::from_consumer_and_token($consumer, $a_params["token"], $a_params["http_method"], $a_params["url"], $a_params["data"]);
     $request->sign_request($method, $consumer, $a_params["token"]);
     // Pass this back up "out of band" for debugging
     self::$last_oauth_base_string = $request->get_signature_base_string();
     return $request->get_parameters();
 }
コード例 #2
0
 /**
  * Apply a function with parameters to fill a field
  * 
  * @param $a_field
  * @param $a_maxdepth
  * @return unknown_type
  */
 private function fillCalculatedField($a_field, $a_maxdepth)
 {
     // process the function parameters
     $parsed_params = array();
     foreach ($a_field['params'] as $param_name => $param_value) {
         foreach ($this->fields as $field_name => $field) {
             if ($param_value == $this->typedef->getPlaceholder($field_name)) {
                 $param_value = $this->fillField($field, $a_maxdepth);
             }
             $parsed_params[$param_name] = $param_value;
         }
     }
     // apply the function
     require_once "./Customizing/global/plugins/Services/Repository/RepositoryObject/ExternalContent/classes/class.ilExternalContentFunctions.php";
     $value = ilExternalContentFunctions::applyFunction($a_field['function'], $parsed_params);
     // save the value so that it is not re-calculated
     $this->fields[$a_field['field_name']]['field_value'] = $value;
     return $value;
 }