Beispiel #1
0
 function action_index()
 {
     // Check and make sure Beans is setup.
     $setup_check = new Beans();
     $setup_check_result = $setup_check->execute();
     if (!$setup_check_result->success && isset($setup_check_result->config_error) && strpos(strtolower($setup_check_result->config_error), 'update') !== FALSE) {
         $this->request->redirect('/update');
     } else {
         if (!$setup_check_result->success) {
             $this->request->redirect('/install');
         }
     }
     if (count($this->request->post())) {
         $auth_login = new Beans_Auth_Login((object) array('email' => $this->request->post('email'), 'password' => $this->request->post('password')));
         $auth_login_result = $auth_login->execute();
         if ($this->_beans_result_check($auth_login_result)) {
             if (isset($auth_login_result->data->reset)) {
                 $this->request->redirect('/auth/reset/' . $auth_login_result->data->reset);
             }
             Session::instance()->set('auth_uid', $auth_login_result->data->auth->auth_uid);
             Session::instance()->set('auth_expiration', $auth_login_result->data->auth->auth_expiration);
             Session::instance()->set('auth_key', $auth_login_result->data->auth->auth_key);
             Session::instance()->set('auth_role', $auth_login_result->data->auth->user->role);
             $this->request->redirect('/');
         }
     }
 }
Beispiel #2
0
 public function before()
 {
     $setup_check = new Beans();
     $setup_check_result = $setup_check->execute();
     if (!Kohana::$is_cli && $this->request->action() != "manual" && ($setup_check_result->success || !isset($setup_check_result->config_error) || strpos(strtolower($setup_check_result->config_error), 'update') === FALSE)) {
         $this->request->redirect('/');
     }
     parent::before();
     $this->_view->head_title = "Update BeansBooks";
     $this->_view->page_title = "Updates Ready to Install";
 }
 public function update($Termos = null)
 {
     $this->getDados();
     return parent::update($Termos);
 }
Beispiel #4
0
 /**
  * Flattens any given object.
  *
  * <p>Criteria for the included data is the ZenMagick naming convention that access methods start with
  * either <code>get</code>, <code>is</code> or <code>has</code>.</p>
  *
  * <p>If the given object is an array, all elements will be converted, too. Generally speaking, this method works
  * recursively. Arrays are preserved, array values, in turn, will be flattened.</p>
  *
  * <p>The methods array may contain nested arrays to allow recursiv method mapping. The Ajax product controller is
  * a good example for this.</p>
  *
  * @param mixed obj The object.
  * @param array methods Optional list of methods to include as properties.
  * @param function formatter Optional formatting method for all values; signature is <code>formatter($obj, $name, $value)</code>.
  * @return array Associative array of methods values.
  */
 public function flattenObject($obj, $properties = null, $formatter = null)
 {
     $props = null;
     if (is_array($obj)) {
         $props = array();
         foreach ($obj as $k => $o) {
             $props[$k] = $this->flattenObject($o, $properties, $formatter);
         }
         return $props;
     }
     if (!is_object($obj)) {
         // as is
         return $obj;
     }
     // properties may be a mix of numeric and string key - ugh!
     $beanProperties = array();
     foreach ($properties as $key => $value) {
         $beanProperties[] = is_array($value) ? $key : $value;
     }
     $props = Beans::obj2map($obj, $beanProperties, false);
     foreach ($props as $key => $value) {
         if (is_object($value) || is_array($value)) {
             $sub = is_array($properties[$key]) ? $properties[$key] : null;
             $value = $this->flattenObject($value, $sub, $formatter);
         }
         $props[$key] = null != $formatter ? $formatter($obj, $key, $value) : $value;
     }
     return $props;
 }
 /**
  * @param Beans $item
  * @throws \MonkeyData\EshopXmlFeedGenerator\XmlGenerator\Exceptions\MonkeyDataMissingInputException
  */
 public function addBean(Beans $item)
 {
     $item->validate();
     $this->add($item);
 }
Beispiel #6
0
 /**
  * Adds a few Beans_ calls to each view ( such as company settings ).
  */
 protected function _beans_default_calls()
 {
     // Get Version
     $b = new Beans();
     $this->_view->beansbooks_version = $b->get_version();
     // Only if logged in.
     if (!strlen(Session::instance()->get('auth_uid')) or !strlen(Session::instance()->get('auth_key')) or !strlen(Session::instance()->get('auth_expiration'))) {
         return FALSE;
     }
     $setup_company_list = new Beans_Setup_Company_List($this->_beans_data_auth());
     $setup_company_list_result = $setup_company_list->execute();
     if ($this->_beans_result_check($setup_company_list_result)) {
         $this->_view->setup_company_list_result = $setup_company_list_result;
     }
     $account_chart = new Beans_Account_Chart($this->_beans_data_auth());
     $account_chart_result = $account_chart->execute();
     if ($this->_beans_result_check($account_chart_result)) {
         $this->_view->account_chart_result = $account_chart_result;
     }
     $account_type_search = new Beans_Account_Type_Search($this->_beans_data_auth());
     $account_type_search_result = $account_type_search->execute();
     if ($this->_beans_result_check($account_type_search_result)) {
         $this->_view->account_type_search_result = $account_type_search_result;
     }
     // We don't want to override something set elsewhere - like in Controller_View_Setup -> action_taxes()
     if (!isset($this->_view->tax_search_result)) {
         $tax_search = new Beans_Tax_Search($this->_beans_data_auth((object) array('search_include_hidden' => TRUE)));
         $tax_search_result = $tax_search->execute();
         if ($this->_beans_result_check($tax_search_result)) {
             $this->_view->tax_search_result = $tax_search_result;
         }
     }
 }
 public function getRowCount()
 {
     $this->getDados();
     return parent::getRowCount();
 }
Beispiel #8
0
 public function __construct($data = NULL)
 {
     parent::__construct($data);
 }