Esempio n. 1
0
 /**
  * Constructor
  */
 public function __construct()
 {
     $this->site = new Collection(SiteEntity::getClass());
     if ($this->config()->exists('sites')) {
         foreach ($this->config()->get('sites') as $site) {
             $entity = new SiteEntity();
             $entity->setData($site);
             $this->addSite($entity);
         }
     }
 }
Esempio n. 2
0
 /**
  * Check post data
  *
  * @param array $post
  * @param \BX\MVC\Entity\SiteEntity $entity
  * @return boolean
  */
 protected function checkFields(array &$post, SiteEntity $entity)
 {
     foreach (['REGEX'] as $field) {
         if (array_key_exists($field, $post)) {
             foreach ($post[$field] as $key => $value) {
                 if ($this->string()->length($value) === 0) {
                     unset($post[$field][$key]);
                 }
             }
         }
     }
     $entity->setData($post);
     $session_token = null;
     if (array_key_exists('SESSION_TOKEN', $post)) {
         $session_token = $post['SESSION_TOKEN'];
     }
     if (intval($session_token) !== $this->session()->getId()) {
         $entity->addError('UNKNOW', $this->trans('mvc.widgets.admin_settings.error_session_token'));
         return false;
     }
     return true;
 }