Exemplo n.º 1
0
 public function main($id, $mode)
 {
     global $db, $user, $src_admin_path, $src_root_path, $phpEx, $template, $request, $cache, $auth, $config;
     $this->db = $db;
     $this->user = $user;
     $this->template = $template;
     $this->request = $request;
     $this->cache = $cache;
     $this->auth = $auth;
     $this->config = $config;
     $this->src_root_path = $src_root_path;
     $this->php_ext = $phpEx;
     $this->default_style = $config['default_style'];
     $this->styles_path = $this->src_root_path . $this->styles_path_absolute . '/';
     $this->u_base_action = append_sid("{$src_admin_path}index.{$this->php_ext}", "i={$id}");
     $this->s_hidden_fields = array('mode' => $mode);
     $this->user->add_lang('acp/styles');
     $this->tpl_name = 'acp_styles';
     $this->page_title = 'ACP_CAT_STYLES';
     $this->mode = $mode;
     $action = $this->request->variable('action', '');
     $post_actions = array('install', 'activate', 'deactivate', 'uninstall');
     foreach ($post_actions as $key) {
         if ($this->request->is_set_post($key)) {
             $action = $key;
         }
     }
     // The uninstall action uses confirm_box() to verify the validity of the request,
     // so there is no need to check for a valid token here.
     if (in_array($action, $post_actions) && $action != 'uninstall') {
         $is_valid_request = check_link_hash($request->variable('hash', ''), $action) || check_form_key('styles_management');
         if (!$is_valid_request) {
             trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action), E_USER_WARNING);
         }
     }
     if ($action != '') {
         $this->s_hidden_fields['action'] = $action;
     }
     $this->template->assign_vars(array('U_ACTION' => $this->u_base_action, 'S_HIDDEN_FIELDS' => build_hidden_fields($this->s_hidden_fields)));
     // Execute actions
     switch ($action) {
         case 'install':
             $this->action_install();
             return;
         case 'uninstall':
             $this->action_uninstall();
             return;
         case 'activate':
             $this->action_activate();
             return;
         case 'deactivate':
             $this->action_deactivate();
             return;
         case 'details':
             $this->action_details();
             return;
         default:
             $this->frontend();
     }
 }
Exemplo n.º 2
0
 /**
  * Bind the values of the request to the form
  *
  * @param \src\request\request_interface $request
  * @return null
  */
 public function bind(\src\request\request_interface $request)
 {
     $this->cc_sender = $request->is_set_post('cc_sender');
     $this->body = $request->variable('message', '', true);
 }