Esempio n. 1
0
        static public function acknowledgeCheck($check=NULL,$result=NULL,$ackAll=false)
	{
	  if (!is_null($check)) {
            if ($ackAll === true) {
    	      $check_results = CheckResult::findAll($check->getCheckId());
            } elseif (!is_null($result)) {
              $check_results = CheckResult::build($result->getResultId());
            }
	    foreach ($check_results as $check_result) {
            fCore::expose($check_result);
             $check_result->setAcknowledged(1);
             $check_result->store();
	    }
	  }
        }       
Esempio n. 2
0
 public function testExposeMultiple()
 {
     ob_start();
     fCore::expose('string', TRUE);
     $output = ob_get_clean();
     $this->assertEquals("Array\n(\n    [0] => string\n    [1] => {true}\n)\n", $output);
 }
 /**
  * @dataProvider serverProvider
  */
 public function testListGet($type, $host, $port, $secure, $username, $password)
 {
     $mailbox = new fMailbox($type, $host, $username, $password, $port, $secure, 5);
     fMailbox::addSMIMEPair('*****@*****.**', './email/tests@flourishlib.com.crt', './email/tests@flourishlib.com.key', EMAIL_PASSWORD);
     $messages = array();
     foreach ($mailbox->listMessages() as $uid => $overview) {
         $info = $mailbox->fetchMessage($uid);
         if (!isset($info['headers'])) {
             fCore::expose($info);
         }
         $messages[$info['headers']['message-id']] = array('subject' => $info['headers']['subject'], 'from' => $info['headers']['from']['mailbox'] . '@' . $info['headers']['from']['host'], 'to' => $info['headers']['to'][0]['mailbox'] . '@' . $info['headers']['from']['host'], 'verified' => !empty($info['verified']) ? $info['verified'] : NULL, 'decrypted' => !empty($info['decrypted']) ? $info['decrypted'] : NULL);
     }
     $expected_output = array('<*****@*****.**>' => array('subject' => 'A Tést of Iñtërnâtiônàlizætiøn', 'from' => '*****@*****.**', 'to' => '*****@*****.**', 'verified' => NULL, 'decrypted' => NULL), '<*****@*****.**>' => array('subject' => 'UTF-8 …', 'from' => '*****@*****.**', 'to' => '*****@*****.**', 'verified' => NULL, 'decrypted' => NULL), '<*****@*****.**>' => array('subject' => 'More UTF-8: ⅞ ⅝ ⅜ ⅛', 'from' => '*****@*****.**', 'to' => '*****@*****.**', 'verified' => NULL, 'decrypted' => NULL), '<*****@*****.**>' => array('subject' => 'Attachments Test', 'from' => '*****@*****.**', 'to' => '*****@*****.**', 'verified' => NULL, 'decrypted' => NULL), '<*****@*****.**>' => array('subject' => 'Inline Images and Attachments', 'from' => '*****@*****.**', 'to' => '*****@*****.**', 'verified' => NULL, 'decrypted' => NULL), '<*****@*****.**>' => array('subject' => 'Multiple To and Cc', 'from' => '*****@*****.**', 'to' => '*****@*****.**', 'verified' => NULL, 'decrypted' => NULL), '<*****@*****.**>' => array('subject' => 'Re: Multiple To and Cc', 'from' => '*****@*****.**', 'to' => '*****@*****.**', 'verified' => NULL, 'decrypted' => NULL), '<*****@*****.**>' => array('subject' => 'Re: Multiple To and Cc', 'from' => '*****@*****.**', 'to' => '*****@*****.**', 'verified' => NULL, 'decrypted' => NULL), '<*****@*****.**>' => array('subject' => 'Re: Multiple To and Cc', 'from' => '*****@*****.**', 'to' => '*****@*****.**', 'verified' => NULL, 'decrypted' => NULL), '<*****@*****.**>' => array('subject' => 'Re: Multiple To and Cc', 'from' => '*****@*****.**', 'to' => '*****@*****.**', 'verified' => NULL, 'decrypted' => NULL), '<*****@*****.**>' => array('subject' => 'Re: Multiple To and Cc', 'from' => '*****@*****.**', 'to' => '*****@*****.**', 'verified' => NULL, 'decrypted' => NULL), '<*****@*****.**>' => array('subject' => 'This message has been signed', 'from' => '*****@*****.**', 'to' => '*****@*****.**', 'verified' => TRUE, 'decrypted' => NULL), '<*****@*****.**>' => array('subject' => 'This message has also been signed', 'from' => '*****@*****.**', 'to' => '*****@*****.**', 'verified' => TRUE, 'decrypted' => NULL));
     if ($username == '*****@*****.**') {
         $expected_output['<*****@*****.**>'] = array('subject' => 'This message is signed and encrypted', 'from' => '*****@*****.**', 'to' => '*****@*****.**', 'verified' => TRUE, 'decrypted' => TRUE);
         $expected_output['<*****@*****.**>'] = array('subject' => 'This message is encrypted', 'from' => '*****@*****.**', 'to' => '*****@*****.**', 'verified' => NULL, 'decrypted' => TRUE);
     }
     $expected_output = array_merge($expected_output, array('<*****@*****.**>' => array('subject' => 'This is a test of fEmail signing', 'from' => '*****@*****.**', 'to' => '*****@*****.**', 'verified' => TRUE, 'decrypted' => NULL), '<*****@*****.**>' => array('subject' => 'This is a test of fEmail encryption', 'from' => '*****@*****.**', 'to' => '*****@*****.**', 'verified' => NULL, 'decrypted' => TRUE), '<*****@*****.**>' => array('subject' => 'This is a test of fEmail encryption + signing', 'from' => '*****@*****.**', 'to' => '*****@*****.**', 'verified' => TRUE, 'decrypted' => TRUE)));
     $this->assertEquals($expected_output, $messages);
 }
Esempio n. 4
0
 /**
  * Processes a form and produces output dependent upon the context in which process() is called.
  *
  * If the form is not being submitted, then it will be rendered in its initial state using the ->value() you set on each
  * element and showing placeholders if set (how these are shown depends on the renderer too.)
  *
  * If the form is being submitted, then it will validate the inputs using any supplied rules and finally validate the form
  * as a whole unit. You can supply validation rules or even callbacks for any element or the whole form.
  *
  * If the validation fails, the form will be re-rendered with the previous input values and with the errors shown.
  *
  * If the validation passes, then the success method will be called. It can take whatever actions are needed to handle the form
  * and it can redirect if needed or simply return some output that will then be rendered in place of the form.
  **/
 public function process()
 {
     $submitted = false;
     $form_ok = true;
     $src = strtoupper($this->_method);
     $this->_form_id = $this->_fingerprint();
     $r = $this->_renderer;
     //
     //	Has process been called following a form submission? Submission => method matches form
     //
     if (strtoupper($_SERVER['REQUEST_METHOD']) === $src) {
         $array = "_{$src}";
         $submitted = !empty($GLOBALS[$array]);
     }
     $r->setSubmitting($submitted);
     if ($submitted) {
         if (true == $this->_meta['show_submitted']) {
             fCore::expose(array($array => $GLOBALS[$array]));
         }
         // Signal to the renderer that a submission is underway. This allows it to conditionally add
         // classes when rendering
         $r->setSubmitting(true);
         // Do the id and token match what is expected?
         $id_ok = $this->_form_id === fRequest::get('_form_id');
         if (!$id_ok) {
             return '<p>An unexpected error occured. Form id mismatch.</p>';
         }
         $this->_form_token = fRequest::get('_form_token');
         $token_ok = fxCSRFToken::check($this->_form_id, $this->_form_token);
         if (!$token_ok) {
             return '<p>An unexpected error occured. Token mismatch.</p>';
         }
         //
         //	Iterate over elements, populating their values & evaluating them
         //
         foreach ($this->_elements as $e) {
             if (!is_string($e)) {
                 $e->_getSubmittedValue()->_validate($this->errors, $this);
             }
         }
         if (empty($this->errors)) {
             //
             //	Run the form validator (if any)
             //
             $validator = $this->_validation_cb;
             if (is_callable($validator)) {
                 $v = $validator($this);
                 $form_ok = true === $v;
             }
             if ($form_ok) {
                 if (is_callable($this->_onSuccess)) {
                     $fn = $this->_onSuccess;
                     return $fn($this);
                 } else {
                     throw new fxProgrammerException("Form submission successful but no onSuccess callback defined.");
                 }
             } else {
                 return $v;
             }
         }
     }
     fxCSRFToken::clear($this->_form_id);
     $this->_form_token = fxCSRFToken::generate($this->_form_id);
     if (true == $this->_show_form_elements) {
         fCore::expose($this);
     } elseif (true == $this->_show_form_errors) {
         fCore::expose($this->errors);
     }
     if (!$this->_form_id || !$this->_form_token) {
         throw new fxProgrammerException("Form cannot be rendered without _form_id and _form_token being defined.");
     }
     return $this->renderUsing($this->_renderer, $this, $this->id);
 }
Esempio n. 5
0
 /**
  * @dataProvider exposeProvider
  */
 public function testExpose($value, $expected_output)
 {
     ob_start();
     fCore::expose($value);
     $output = ob_get_clean();
     $this->assertEquals($expected_output, $output);
 }
 public function renderForm(fxForm &$f)
 {
     $this->rendering_element_set = false;
     $o = array();
     $atts = $this->renderAtts($f->_getInfoExcept('name'));
     $o[] = "<form action=\"{$f->_action}\" method=\"{$f->_method}\"{$atts}>";
     $o[] = "<input type=\"hidden\" name=\"_form_id\" value=\"{$f->_form_id}\" />";
     $o[] = "<input type=\"hidden\" name=\"_form_token\" value=\"{$f->_form_token}\" />";
     if ($f->hasErrors()) {
         // Use a form errors formatting callback to override basic message.
         $formErrorsCB = $this->errorBlockFormatter;
         if (is_callable($formErrorsCB)) {
             $msg = $formErrorsCB($f);
             if (is_string($msg) && '' !== $msg) {
                 $o[] = $msg;
             }
         } else {
             $o[] = '<div class="form-errors"><p>There was a problem with your form. Please correct any errors and try again.</p></div>';
         }
     }
     foreach ($f->getElements() as $child) {
         if (is_string($child)) {
             $o[] = $child;
         } else {
             $o[] = $child->renderUsing($this, $f, $f->id);
         }
     }
     $o[] = "</form>";
     $o = implode("\n", $o);
     if (true == $f->_show_html) {
         fCore::expose($o);
     }
     return $o;
 }
Esempio n. 7
0
 public function checkExposure(fxFormElement &$e, $html)
 {
     if ($e->_inMeta('show_data')) {
         fCore::expose(array("Data for {$e->_name}" => $e->_getData()));
     }
     if ($e->_inMeta('show_meta')) {
         fCore::expose(array("Meta-data for {$e->_name}" => $e->_getMeta()));
     }
     if ($e->_inMeta('show_submitted')) {
         fCore::expose(array("Submitted value for {$e->name}" => $e->_value));
     }
     if ($e->_inMeta('show_elements')) {
         fCore::expose(array("{$e->name}" => $e));
     }
     if ($e->_inMeta('show_errors')) {
         fCore::expose(array("Errors for {$e->name}" => $e->_getErrors()));
     }
     if ($e->_inMeta('show_html')) {
         fCore::expose(array("HTML for {$e->name}" => $html));
     }
 }
function carrier_pidgin_settings(){
  fCore::expose($carriers); 
}