Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

It provides a similar 'Default' functionality to DB_Helper, as well as attempting to automatically remove known attack vectors.

Code Block
languagephp
class Ponies extends FreePBX_Helpers implements BMO {
	public static reqDefaults = array ("protocol" => "sip");
 
	public function foo() {
		// Assuming $_REQUEST contains "type" => "Submit", 'text' => "O'Malley"
		$type = $this->getReq("type");
		$text = $this->getReq("text");
		$protocol = $this->getReq("protocol");
		$foo = $this->getReq("nothanks");
 
		// Now:
		//  $type = "Submit" (obviously)
		//  $text = "O'Malley"  (Because of automatic attack mitigation)
		//  $protocol = "sip" (Because it wasn't defined, and there's a default)
		//  $foo = false (It wasn't defined, and there was no default)
	}
}

...