Exemplo n.º 1
0
 /**
  * Change base template from decorator and request data
  *
  * @param array $template - template provided from create function
  */
 protected function input($template = array())
 {
     $_this = $this->_decorator = $this->getInstance('decorator', 'bDecorator');
     $this->_request = $this->getInstance('request', 'bRequest');
     $this->_db = $this->getInstance('db', 'bDocumentation__bDataMapper');
     // Decor template
     $decorTemplate = $_this->getData($template);
     $requestTemplate = $this->_request->get('blib') === __CLASS__ ? array('id' => $this->_request->get('id'), 'ajax' => $this->_request->get('ajax')) : array();
     $this->_template = array_replace_recursive($this->_template, $decorTemplate, $requestTemplate);
 }
Exemplo n.º 2
0
 /**
  * @param array $data	- get request data
  */
 protected function input($data = array())
 {
     $this->_request = $this->getInstance('request', 'bRequest');
     $this->_db = $this->getInstance('db', 'bAnnounces__bDataMapper');
     $this->_decorator = $this->getInstance('decorator', 'bDecorator');
     $this->_converter = $this->getInstance('converter', 'bConverter');
     $tunnel = (array) $this->_request->get(__CLASS__);
     $request = array('count' => $this->_request->get('count'), 'limit' => $this->_request->get('limit'));
     // Glue request params
     $this->_mvc = array_replace($this->_mvc, $request, $tunnel, $data);
 }
Exemplo n.º 3
0
 /**
  * Overload object factory for Singleton
  *
  * @return bRequest|null|static
  */
 public static function create()
 {
     if (self::$_instance === null) {
         self::$_instance = parent::create(func_get_args());
     }
     return self::$_instance;
 }
Exemplo n.º 4
0
 /**
  * this is for the omnigrid table management
  *
  * @access public
  * @return boolean True on success
  */
 function getPageList()
 {
     if ($page = bRequest::getVar("page", 0)) {
         $page = true;
         $page = intval(bRequest::getVar("page"));
         $perpage = intval(bRequest::getVar("perpage"));
         $n = ($page - 1) * $perpage;
     }
     //setting pagination query
     $limit = "";
     if ($page) {
         $limit = " LIMIT {$n}, {$perpage}";
     }
     // this variables Omnigrid will send only if serverSort option is true
     $sorton = bRequest::getVar("sorton", false);
     $sortby = bRequest::getVar("sortby");
     //setting pagination query
     $where = "";
     if ($sorton) {
         $where = " ORDER BY {$sorton} {$sortby} ";
     }
     //set the query
     $query = "SELECT * FROM " . $this->_tbl . $where . $limit;
     //set and run the query
     $this->_db->setQuery($query);
     $this->_db->query();
     $results = $this->_db->loadAssocList();
     //set the query
     $query = "SELECT * FROM " . $this->_tbl;
     //set and run the query
     $this->_db->setQuery($query);
     $this->_db->query();
     $total = $this->_db->getNumRows();
     // return the json results
     $return = array("page" => $page, "total" => $total, "data" => $results);
     echo json_encode($return);
     return;
 }
 /**
  * Cleans the request from script injection.
  *
  * @static
  * @return	void
  * @since	1.5
  */
 public static function clean()
 {
     bRequest::_cleanArray($_FILES);
     bRequest::_cleanArray($_ENV);
     bRequest::_cleanArray($_GET);
     bRequest::_cleanArray($_POST);
     bRequest::_cleanArray($_COOKIE);
     bRequest::_cleanArray($_SERVER);
     if (isset($_SESSION)) {
         bRequest::_cleanArray($_SESSION);
     }
     $REQUEST = $_REQUEST;
     $GET = $_GET;
     $POST = $_POST;
     $COOKIE = $_COOKIE;
     $FILES = $_FILES;
     $ENV = $_ENV;
     $SERVER = $_SERVER;
     if (isset($_SESSION)) {
         $SESSION = $_SESSION;
     }
     foreach ($GLOBALS as $key => $value) {
         if ($key != 'GLOBALS') {
             unset($GLOBALS[$key]);
         }
     }
     $_REQUEST = $REQUEST;
     $_GET = $GET;
     $_POST = $POST;
     $_COOKIE = $COOKIE;
     $_FILES = $FILES;
     $_ENV = $ENV;
     $_SERVER = $SERVER;
     if (isset($SESSION)) {
         $_SESSION = $SESSION;
     }
     // Make sure the request hash is clean on file inclusion
     $GLOBALS['_JREQUEST'] = array();
 }
Exemplo n.º 6
0
 /**
  * stores the data
  * @return none
  */
 function saveCapabilities()
 {
     $table =& bTable::getInstance($this->table, 'Table');
     $table->load(bRequest::getVar('role'));
     $table->setCapabilities(bRequest::get('get'));
     print_r($table->getProperties());
     $table->store();
     echo 'Item Saved!';
 }
 /**
  * deletes the record
  * @return none
  */
 function delete()
 {
     $table =& bTable::getInstance($this->table, 'Table');
     //loop through the keys
     $keys = split(',', bRequest::getVar('keys'));
     foreach ($keys as $key => $id) {
         if ($id != '') {
             //$table->load( $id );
             $table->delete($id);
         }
     }
     echo 'Items Deleted.';
 }
Exemplo n.º 8
0
 /**
  * Get property from [set data]->[tunnel data]->[request data]->[some default value]->null (use this order)
  *
  * @param string $name  - property name
  * @param null $default - default value
  * @return mixed|null   - property value
  */
 protected final function get($name = '', $default = null)
 {
     $tunnel = (array) $this->_request->get(get_class($this));
     $request = $this->_request->get($name, $default);
     return isset($tunnel[$name]) ? $tunnel[$name] : $request;
 }