public function get_current_user_credentials() { if (AuthComponent::user()) { $id = AuthComponent::user('id'); $m = ClassRegistry::init('User'); $user = $m->findById($id); vomit($id); vomit($user); return $user; } return null; }
public function add() { $this->autoRender = false; if ($this->request->is('post')) { vomit($this->request->data); $this->User->create(); if ($this->User->saveAssociated($this->request->data, array('deep' => true))) { $this->Session->setFlash(__('The user has been saved')); //$this->redirect(array('action' => 'index')); } else { $this->Session->setFlash(__('The user could not be saved. Please, try again.')); } } $roles = $this->User->Role->find('list'); $this->set(compact('roles')); $this->render('Users/form'); }
/** * Displays detailed help about a HeavyMetal shell command. * * @usage ./metal help your/command/uri * @param $uri The URI of the shell command to display help about. */ public function index($uri) { try { try { $s = new ShellDispatcher($uri); $f = $s->find(); } catch (Exception $ex) { $s = new SysShellDispatcher($uri); $f = $s->find(); } } catch (Exception $ex) { vomit($ex->getTrace()); echo "Could not find a suitable controller for {$uri} - are you sure you got it right?"; } $method = new ReflectionMethod($f['classname'], $f['found_action']); $help = $method->getDocComment(); $help = explode("\n", $help); $description = ''; $switches = array(); $params = array(); $usage = ''; foreach ($help as $line) { if (strpos(trim($line, "\t \n"), '/**') === FALSE && strpos(trim($line, "\t \n"), '*/') === FALSE) { $line = trim($line, "\t* "); if (strpos($line, '@') === FALSE) { $description .= $line; } else { if (strpos($line, '@usage') === 0) { $usage = substr($line, 6); } else { $matches = array(); preg_match_all('#([@a-z0-9]*) ([$a-z0-9]*) (.*)#', $line, $matches); switch ($matches[1][0]) { case '@switch': $switches[$matches[2][0]] = $matches[3][0]; break; case '@param': $params[trim($matches[2][0], '$')] = $matches[3][0]; break; } } } } } return array('description' => $description, 'usage' => $usage, 'switches' => $switches, 'params' => $params); }
public function addqueue($queue) { $q = MessageQueue::GetQueue('sqs'); $q->create_queue($queue); vomit($q->list_queues()); }
public function get_single() { if ($this->field != null) { if (isset($this->parent->fields[$this->field])) { if ($this->field == $this->parent->primary_key) { $field = $this->parent->primary_key_value; } else { // yo pdm what is this db->escape_value stuff? if (is_string($this->field)) { $field = $this->parent->__get($this->field); } else { $field = $this->parent->db->escape_value($this->field->type, $this->field->value); } } if ($field == null || $field == '' || $field == "''") { return null; } return filter($this->model)->{$this->foreign_field}->equals($field)->first(); } else { throw new ModelException("The field '{$this->field}' could not be found on the parent model."); } } else { vomit($this); return filter($this->model)->{$this->foreign_field}->equals($this->parent->primary_key_value)->first(); } vomit($this); }
<?php get_header(); ?> <div class="container-fluid page-content top-part"> </div> <div class="container bottom-part"> <?php vomit($post); ?> </div> <?php get_footer();
public function blackhole($type) { // handle errors. vomit($type); }
public static function Exception($exception) { vomit($exception); throw $exception; }
/** * Sends the request * * @return SimpleXMLElement */ public function send($queue = null) { $this->parameters['Signature'] = $this->sign('GET', $queue); $request = new HTTP_Request($this->endpoint); $request->setMethod('GET'); foreach ($this->parameters as $name => $value) { $request->addQueryString($name, $value); } $misses = 0; for (;;) { $request->sendRequest(); //@TODO: Add handling for different status codes if ($request->getResponseCode() == 200) { break; } vomit($request->getResponseBody()); $misses++; sleep($misses); if ($misses == 3) { throw new AWSException($request->getResponseBody()); } } $body = $request->getResponseBody(); $response = simplexml_load_string($body); if ($response->Errors) { throw new AWSException($response->Errors->Error->Message); } return $response; }
/** * Performs a save. * @param $document * @return void */ private function _save($document) { if (!$document->pre_save(false)) { return; } $c = $this->collection($document->doc_collection); try { $c->insert($document->to_array()); } catch (Exception $ex) { vomit($ex); } $document->doc_state = Document::DOCUMENT_LIVE; $document->post_save(false); }