예제 #1
0
 /**
  * @todo secure code
  * change_field
  * quick_edit
  * POST: field: $this.attr('name'), value: $this.val()
  */
 function action_change_field()
 {
     $field = $this->request->post('field');
     $value = $this->request->post('value');
     if ($this->request->method == 'GET') {
         $this->_ajax_answer(false, i18n::T('Method not available'));
         return;
     }
     if (!$field || !$this->collection->get_field($field)) {
         $this->_ajax_answer(false, i18n::T('Field change failed'));
         return;
     }
     if (is_callable(array($this, 'action_change_field_before'))) {
         if (false === $this->action_change_field_before($field, $value)) {
             return false;
         }
     }
     $_item = $this->_load_id();
     $_item->set_data($field, $value);
     $_item->update_fields($field);
     if ($this->in_ajax()) {
         $this->_ajax_answer(true, i18n::T('Field modified'));
     }
     $this->disable_render(true);
     if (is_callable(array($this, 'action_change_field_after'))) {
         $this->action_change_field_after($field, $value);
     }
 }
예제 #2
0
 /**
  * Activate filter
  */
 function activate()
 {
     core::dprint('Activate RSS');
     // tpl_loader::set_template('');
     core::lib('renderer')->set_page_template('root.embed');
     tf_request::set_ident('embed', 'yes');
 }
예제 #3
0
 /**
  * Called from module::on_editor
  * @throws acl_exception
  */
 function on_editor($mod)
 {
     $this->module = $mod;
     $section = core::get_params('c');
     $id = (int) core::get_params('id');
     // module checks goes on top, so skip if section empty
     if (empty($section)) {
         return;
     }
     if (!core::module('users')->with_acls()) {
         return;
     }
     // override section acl / id
     if (isset($this->_actions[$section]['acl_id'])) {
         $id = core::get_params($this->_actions[$section]['acl_id']);
     }
     if (isset($this->_actions[$section]['acl'])) {
         $section = $this->_actions[$section]['acl'];
     }
     $op = 'read';
     // @todo check this
     $is_submitted = (bool) $this->request->get_post('is_submitted', 0);
     $_op = core::get_params('op');
     if ($_op == 'edit') {
         $op = 'update';
     }
     if ($_op == 'drop') {
         $op = 'delete';
     }
     if (empty($id) && $is_submitted) {
         $op = 'create';
     }
     if (!empty($id) && $is_submitted) {
         $op = 'update';
     }
     if (is_callable(array($mod, 'editor_check_acls'))) {
         $result = call_user_func(array($mod, 'editor_check_acls'), array('section' => &$section, 'section_id' => &$id, 'action' => &$op));
         // WARN! true skips checks
         if ($result === true) {
             return;
         }
     }
     $this->check_acls($section, $id, $op);
 }
예제 #4
0
 /**
  * Create request
  */
 function __construct()
 {
     $this->method = @$_SERVER['REQUEST_METHOD'];
     $this->_host = @$_SERVER['HTTP_HOST'];
     $this->_uri = @$_SERVER['REQUEST_URI'];
     $this->_post = $_POST;
     $this->_get = $_GET;
     $this->_files = $_FILES;
     $this->_cookies = $_COOKIE;
     $this->_normalize_files();
     $this->_all = functions::array_merge_recursive_distinct($_COOKIE, $this->_get);
     $this->_all = functions::array_merge_recursive_distinct($this->_all, $this->_post);
     $this->_all = functions::array_merge_recursive_distinct($this->_all, $this->_files);
     // @todo use self::TAG_ ..
     self::$_ident_vars = new ident_vars(array('id' => $this->postget('id'), 'pid' => $this->postget('pid'), 'gid' => $this->postget('gid'), 'c' => $this->postget('c'), 'op' => $this->postget('op'), 'do' => $this->postget('do'), 'type' => $this->postget('type'), 'embed' => $this->postget('embed'), 'start' => $this->postget('start'), '2print' => $this->postget('2print'), 'm' => preg_replace('/[^\\w\\d]/', '', $this->postget('m', ''))));
 }