trigger() публичный статический Метод

Triggers an individual event.
public static trigger ( string $event_name = NULL, mixed $payload = NULL ) : void
$event_name string A string with the name of the event to trigger. Case sensitive.
$payload mixed (optional) An array to send to the event method.
Результат void
 /**
  * @see TransactionManagerInterface::rollback
  */
 public function rollback()
 {
     if (!$this->transactionInProgress) {
         throw new TransactionException("No transaction is started.");
     }
     $this->Events->trigger('TransactionManager.rollback');
     $this->transactionInProgress = false;
     return $this;
 }
Пример #2
0
 public function destroy()
 {
     // Run the standard CI_Cart function
     parent::destroy();
     // Fire an event to tell external modules that the cart has been destroyed
     Events::trigger('cart_destroyed');
 }
Пример #3
0
 /**
  * Shows the permissions for a specific user group.
  *
  * @param int $group_id The id of the group to show permissions for.
  */
 public function group($group_id)
 {
     $this->load->library('form_validation');
     if ($_POST) {
         $modules = $this->input->post('modules');
         $roles = $this->input->post('module_roles');
         // Save the permissions.
         if ($this->permission_m->save($group_id, $modules, $roles)) {
             // Fire an event. Permissions have been saved.
             Events::trigger('permissions_saved', array($group_id, $modules, $roles));
         }
         $this->session->set_flashdata('success', lang('permissions:message_group_saved_success'));
         $this->input->post('btnAction') === 'save_exit' ? redirect('admin/permissions') : redirect('admin/permissions/group/' . $group_id);
     }
     // Get the group data
     $group = $this->group_m->get($group_id);
     // If the group data could not be retrieved
     if (!$group) {
         // Set a message to notify the user.
         $this->session->set_flashdata('error', lang('permissions:message_no_group_id_provided'));
         // Send him to the main index to select a proper group.
         redirect('admin/permissions');
     }
     // See if this is the admin group
     $group_is_admin = (bool) ($this->config->item('admin_group', 'ion_auth') == $group->name);
     // Get the groups permission rules (no need if this is the admin group)
     $edit_permissions = $group_is_admin ? array() : $this->permission_m->get_group($group_id);
     // Get all the possible permission rules from the installed modules
     $permission_modules = $this->module_m->get_all(array('is_backend' => true, 'installed' => true));
     foreach ($permission_modules as &$permission_module) {
         $permission_module['roles'] = $this->module_m->roles($permission_module['slug']);
     }
     $this->template->append_js('module::group.js')->set('edit_permissions', $edit_permissions)->set('group_is_admin', $group_is_admin)->set('permission_modules', $permission_modules)->set('group', $group)->build('admin/group');
 }
 public function index()
 {
     $this->load->parser();
     $validation_rules = array(array('field' => 'email_test_form_captcha', 'label' => 'Captcha', 'rules' => 'nohtml|trim|callback__captcha'));
     $success = false;
     $messages = array();
     $this->form_validation->set_rules($validation_rules);
     if ($this->form_validation->run()) {
         $custom_text = $this->input->post('custom_text');
         $custom_html = trim($custom_text) != '' ? $this->parser->parse_string($custom_text, null, true, array('textile' => array('restricted_mode' => true))) : '';
         $success = (bool) Events::trigger('email_test', array('custom_text' => $custom_html));
         if ($success) {
             $messages[] = $this->lang->line('mailer_your_message_has_been_sent');
         } else {
             if ($this->registry->get('email_debugger') != '') {
                 $messages[] = $this->lang->line('mailer_error') . '<br /><br />' . $this->registry->get('email_debugger');
             } else {
                 $messages[] = $this->lang->line('mailer_error');
             }
         }
     } else {
         $messages = validation_errors_array();
     }
     extract(Modules::run('email/test/get_message'));
     $has_logo = file_exists(DEFAULTFCPATH . 'apple-touch-icon-precomposed.png');
     $body = $this->parser->parse_string($body, array('has_logo' => $has_logo, 'logo_src' => default_base_url('apple-touch-icon-precomposed.png')), true, 'mustache');
     $this->captcha->clear();
     $this->template->set(compact('success', 'messages', 'subject', 'body'))->enable_parser_body('i18n')->build('email_test');
 }
Пример #5
0
 /**
  * 버전정보 페이지입니다
  */
 public function index()
 {
     // 이벤트 라이브러리를 로딩합니다
     $eventname = 'event_admin_config_cbversion_index';
     $this->load->event($eventname);
     $view = array();
     $view['view'] = array();
     // 이벤트가 존재하면 실행합니다
     $view['view']['event']['before'] = Events::trigger('before', $eventname);
     Requests::register_autoloader();
     $headers = array('Accept' => 'application/json');
     $postdata = array('requesturl' => current_full_url(), 'package' => CB_PACKAGE, 'version' => CB_VERSION);
     $request = Requests::post(config_item('ciboard_check_latest_version'), $headers, $postdata);
     $view['view']['latest_versions'] = json_decode($request->body, true);
     if (strtolower(CB_PACKAGE) === 'premium') {
         $view['view']['latest_version_name'] = $view['view']['latest_versions']['premium_version'];
         $view['view']['latest_download_url'] = $view['view']['latest_versions']['premium_downloadurl'];
     } else {
         $view['view']['latest_version_name'] = $view['view']['latest_versions']['basic_version'];
         $view['view']['latest_download_url'] = $view['view']['latest_versions']['basic_downloadurl'];
     }
     // 이벤트가 존재하면 실행합니다
     $view['view']['event']['before_layout'] = Events::trigger('before_layout', $eventname);
     /**
      * 어드민 레이아웃을 정의합니다
      */
     $layoutconfig = array('layout' => 'layout', 'skin' => 'index');
     $view['layout'] = $this->managelayout->admin($layoutconfig, $this->cbconfig->get_device_view_type());
     $this->data = $view;
     $this->layout = element('layout_skin_file', element('layout', $view));
     $this->view = element('view_skin_file', element('layout', $view));
 }
Пример #6
0
 /**
  * Login the user
  *
  * @return	void
  */
 public function login()
 {
     // Check post and session for the redirect place
     $redirect_to = $this->input->post('redirect_to') ? trim(urldecode($this->input->post('redirect_to'))) : $this->session->userdata('redirect_to');
     // Any idea where we are heading after login?
     if (!$_POST and $args = func_get_args()) {
         $this->session->set_userdata('redirect_to', $redirect_to = implode('/', $args));
     }
     // This persists the login redirect
     $this->session->set_userdata('login_redirect', $this->session->userdata('login_redirect'));
     //validate form input
     $this->form_validation->set_rules('username', 'Username', 'required');
     $this->form_validation->set_rules('password', 'Password', 'required');
     // If the validation worked, or the user is already logged in
     if ($this->form_validation->run() or $this->current_user) {
         //		if ($this->form_validation->run()) {
         // Kill the session
         $this->session->unset_userdata('redirect_to');
         // trigger a post login event for third party
         Events::trigger('post_user_login');
         $remember = $this->input->post('remember') == 1 ? TRUE : FALSE;
         if ($this->ion_auth->login($this->input->post('username'), $this->input->post('password'), $remember, 0)) {
             $redirect = $this->session->userdata('login_redirect') ? $this->session->userdata('login_redirect') : 'admin';
             $this->session->set_userdata('success', $this->ion_auth->messages());
             redirect($redirect, 'refresh');
         }
     }
     $this->template->set_layout('login')->build('login');
 }
Пример #7
0
 /**
  * banner url 이동 관련 함수입니다
  */
 public function banner($ban_id = 0)
 {
     // 이벤트 라이브러리를 로딩합니다
     $eventname = 'event_gotourl_banner';
     $this->load->event($eventname);
     // 이벤트가 존재하면 실행합니다
     Events::trigger('before', $eventname);
     $ban_id = (int) $ban_id;
     if (empty($ban_id) or $ban_id < 1) {
         show_404();
     }
     $this->load->model(array('Banner_model'));
     $banner = $this->Banner_model->get_one($ban_id);
     if (!element('ban_id', $banner)) {
         show_404();
     }
     if (!element('ban_activated', $banner)) {
         show_404();
     }
     if (!element('ban_url', $banner)) {
         show_404();
     }
     if (!$this->session->userdata('banner_click_' . $ban_id)) {
         $this->session->set_userdata('banner_click_' . $ban_id, '1');
         $this->Banner_model->update_plus($ban_id, 'ban_hit', 1);
     }
     // 이벤트가 존재하면 실행합니다
     Events::trigger('after', $eventname);
     redirect(prep_url(element('ban_url', $banner)));
 }
Пример #8
0
 public function view_order($id)
 {
     // Variables
     $user = isset($this->current_user->id) ? $this->current_user->id : NULL;
     $order = $this->orders_m->get_order_by_id($id);
     // Check user can view
     if ($user != NULL and $order != FALSE and $user == $order['created_by']['user_id']) {
         // Format order for display
         $order['price_sub'] = number_format($order['price_sub'], 2);
         $order['price_ship'] = number_format($order['price_ship'], 2);
         $order['price_total'] = number_format($order['price_total'], 2);
         // Format products
         foreach ($order['items'] as &$item) {
             $item['price'] = number_format($item['price'], 2);
         }
         // Build page
         $this->template->title(sprintf(lang('firesale:orders:view_order'), $id))->set_breadcrumb('Home', '/home')->set_breadcrumb(lang('firesale:orders:my_orders'), '/users/orders')->set_breadcrumb(sprintf(lang('firesale:orders:view_order'), $id), '/users/orders/' . $id)->set($order);
         // Fire events
         Events::trigger('page_build', $this->template);
         // Build page
         $this->template->build('orders_single');
     } else {
         // Must be logged in
         $this->set_flashdata('error', lang('firesale:orders:logged_in'));
         redirect('/users/login');
     }
 }
Пример #9
0
 /**
  * 전체 메인 페이지입니다
  */
 public function index()
 {
     // 이벤트 라이브러리를 로딩합니다
     $eventname = 'event_main_index';
     $this->load->event($eventname);
     $view = array();
     $view['view'] = array();
     // 이벤트가 존재하면 실행합니다
     $view['view']['event']['before'] = Events::trigger('before', $eventname);
     $where = array('brd_search' => 1);
     $board_id = $this->Board_model->get_board_list($where);
     $board_list = array();
     if ($board_id && is_array($board_id)) {
         foreach ($board_id as $key => $val) {
             $board_list[] = $this->board->item_all(element('brd_id', $val));
         }
     }
     $view['view']['board_list'] = $board_list;
     $view['view']['canonical'] = site_url();
     // 이벤트가 존재하면 실행합니다
     $view['view']['event']['before_layout'] = Events::trigger('before_layout', $eventname);
     /**
      * 레이아웃을 정의합니다
      */
     $page_title = $this->cbconfig->item('site_meta_title_main');
     $meta_description = $this->cbconfig->item('site_meta_description_main');
     $meta_keywords = $this->cbconfig->item('site_meta_keywords_main');
     $meta_author = $this->cbconfig->item('site_meta_author_main');
     $page_name = $this->cbconfig->item('site_page_name_main');
     $layoutconfig = array('path' => 'main', 'layout' => 'layout', 'skin' => 'main', 'layout_dir' => $this->cbconfig->item('layout_main'), 'mobile_layout_dir' => $this->cbconfig->item('mobile_layout_main'), 'use_sidebar' => $this->cbconfig->item('sidebar_main'), 'use_mobile_sidebar' => $this->cbconfig->item('mobile_sidebar_main'), 'skin_dir' => $this->cbconfig->item('skin_main'), 'mobile_skin_dir' => $this->cbconfig->item('mobile_skin_main'), 'page_title' => $page_title, 'meta_description' => $meta_description, 'meta_keywords' => $meta_keywords, 'meta_author' => $meta_author, 'page_name' => $page_name);
     $view['layout'] = $this->managelayout->front($layoutconfig, $this->cbconfig->get_device_view_type());
     $this->data = $view;
     $this->layout = element('layout_skin_file', element('layout', $view));
     $this->view = element('view_skin_file', element('layout', $view));
 }
Пример #10
0
 function index()
 {
     //Set your email
     $your_email = "*****@*****.**";
     //Load form_validation library
     $this->load->library('form_validation');
     //Set validation rules
     $this->form_validation->set_rules('name', lang('label_name'), 'trim|required');
     $this->form_validation->set_rules('lastname', lang('label_lastname'), 'trim|required');
     $this->form_validation->set_rules('message', lang('label_message'), 'trim|required');
     //Is it valid?
     if (!$this->form_validation->run()) {
         //No it isn't, show the form agan
         $this->template->append_metadata($this->load->view('fragments/wysiwyg', $this->data, TRUE))->build('form');
     } else {
         //Yes it is, let's get data
         //Get user id
         $user_id = $this->current_user->id;
         //I need also the user email for the answare, i can get it from users table
         $user_email = $this->supporto_m->get_user_email($user_id);
         //Set template and other info
         $email = array('slug' => 'support_email_template', 'to' => $your_email, 'from' => $user_email, 'name' => $this->input->post('name'), 'lastname' => $this->input->post('lastname'), 'message' => $this->input->post('message'));
         //Send email
         if (Events::trigger('email', $email, 'array')) {
             $this->session->set_flashdata('success', lang('success_email'));
         } else {
             $this->session->set_flashdata('error', lang('error_email'));
         }
         redirect('admin/supporto');
     }
 }
Пример #11
0
 /**
  * Class constructor
  *
  */
 public function __construct()
 {
     parent::__construct();
     Events::trigger('before_front_controller');
     $this->load->library('template');
     $this->set_current_user();
     Events::trigger('after_front_controller');
 }
Пример #12
0
    public function __construct()
    {
        parent::__construct();
        $this->benchmark->mark('public_controller_start');
        //check for a redirect
        $this->load->model('redirects/redirect_m');
        $uri = trim(uri_string(), '/');
        if ($redirect = $this->redirect_m->get_from($uri)) {
            redirect($redirect->to);
        }
        Events::trigger('public_controller');
        // Check the frontend hasnt been disabled by an admin
        if (!$this->settings->frontend_enabled && (empty($this->current_user) or $this->current_user->group != 'admin')) {
            header('Retry-After: 600');
            $error = $this->settings->unavailable_message ? $this->settings->unavailable_message : lang('cms_fatal_error');
            show_error($error, 503);
        }
        // -- Navigation menu -----------------------------------
        $this->load->model('pages/page_m');
        // Load the current theme so we can set the assets right away
        ci()->theme = $this->theme_m->get();
        if (empty($this->theme->slug)) {
            show_error('This site has been set to use a theme that does not exist. If you are an administrator please ' . anchor('admin/themes', 'change the theme') . '.');
        }
        // Prepare Asset library
        $this->asset->set_theme($this->theme->slug);
        // Set the front-end theme directory
        $this->config->set_item('theme_asset_dir', dirname($this->theme->path) . '/');
        $this->config->set_item('theme_asset_url', BASE_URL . dirname($this->theme->web_path) . '/');
        // Set the theme view folder
        $this->template->set_theme($this->theme->slug)->append_metadata('
				<script type="text/javascript">
					var APPPATH_URI = "' . APPPATH_URI . '";
					var BASE_URI = "' . BASE_URI . '";
				</script>');
        // Is there a layout file for this module?
        if ($this->template->layout_exists($this->module . '.html')) {
            $this->template->set_layout($this->module . '.html');
        } elseif ($this->template->layout_exists('default.html')) {
            $this->template->set_layout('default.html');
        }
        // Make sure whatever page the user loads it by, its telling search robots the correct formatted URL
        $this->template->set_metadata('canonical', site_url($this->uri->uri_string()), 'link');
        // If there is a blog module, link to its RSS feed in the head
        if (module_exists('blog')) {
            $this->template->append_metadata('<link rel="alternate" type="application/rss+xml" title="' . $this->settings->site_name . '" href="' . site_url('blog/rss/all.rss') . '" />');
        }
        // Frontend data
        $this->load->library('variables/variables');
        // grab the theme options if there are any
        $this->theme->options = $this->pyrocache->model('theme_m', 'get_values_by', array(array('theme' => $this->theme->slug)));
        // Assign segments to the template the new way
        $this->template->variables = $this->variables->get_all();
        $this->template->settings = $this->settings->get_all();
        $this->template->server = $_SERVER;
        $this->template->theme = $this->theme;
        $this->benchmark->mark('public_controller_end');
    }
Пример #13
0
 /**
  * 게시판 그룹 페이지입니다
  */
 public function index($bgr_key = '')
 {
     // 이벤트 라이브러리를 로딩합니다
     $eventname = 'event_group_index';
     $this->load->event($eventname);
     if (empty($bgr_key)) {
         show_404();
     }
     $view = array();
     $view['view'] = array();
     // 이벤트가 존재하면 실행합니다
     $view['view']['event']['before'] = Events::trigger('before', $eventname);
     $group_id = $this->board_group->item_key('bgr_id', $bgr_key);
     if (empty($group_id)) {
         show_404();
     }
     $group = $this->board_group->item_all($group_id);
     $select = 'brd_id';
     $where = array('bgr_id' => element('bgr_id', $group), 'brd_search' => 1);
     $board_id = $this->Board_model->get_board_list($where);
     $board_list = array();
     if ($board_id && is_array($board_id)) {
         foreach ($board_id as $key => $val) {
             $board_list[] = $this->board->item_all(element('brd_id', $val));
         }
     }
     $view['view']['board_list'] = $board_list;
     $view['view']['canonical'] = group_url($bgr_key);
     // 이벤트가 존재하면 실행합니다
     $view['view']['event']['before_layout'] = Events::trigger('before_layout', $eventname);
     /**
      * 레이아웃을 정의합니다
      */
     $page_title = $this->cbconfig->item('site_meta_title_group');
     $meta_description = $this->cbconfig->item('site_meta_description_group');
     $meta_keywords = $this->cbconfig->item('site_meta_keywords_group');
     $meta_author = $this->cbconfig->item('site_meta_author_group');
     $page_name = $this->cbconfig->item('site_page_name_group');
     $searchconfig = array('{그룹명}', '{그룹아이디}');
     $replaceconfig = array(element('bgr_name', $group), $bgr_key);
     $page_title = str_replace($searchconfig, $replaceconfig, $page_title);
     $meta_description = str_replace($searchconfig, $replaceconfig, $meta_description);
     $meta_keywords = str_replace($searchconfig, $replaceconfig, $meta_keywords);
     $meta_author = str_replace($searchconfig, $replaceconfig, $meta_author);
     $page_name = str_replace($searchconfig, $replaceconfig, $page_name);
     $layout_dir = element('group_layout', $group) ? element('group_layout', $group) : $this->cbconfig->item('layout_group');
     $mobile_layout_dir = element('group_mobile_layout', $group) ? element('group_mobile_layout', $group) : $this->cbconfig->item('mobile_layout_group');
     $use_sidebar = element('group_sidebar', $group) ? element('group_sidebar', $group) : $this->cbconfig->item('sidebar_group');
     $use_mobile_sidebar = element('group_mobile_sidebar', $group) ? element('group_mobile_sidebar', $group) : $this->cbconfig->item('mobile_sidebar_group');
     $skin_dir = element('group_skin', $group) ? element('group_skin', $group) : $this->cbconfig->item('skin_group');
     $mobile_skin_dir = element('group_mobile_skin', $group) ? element('group_mobile_skin', $group) : $this->cbconfig->item('mobile_skin_group');
     $layoutconfig = array('path' => 'group', 'layout' => 'layout', 'skin' => 'group', 'layout_dir' => $layout_dir, 'mobile_layout_dir' => $mobile_layout_dir, 'use_sidebar' => $use_sidebar, 'use_mobile_sidebar' => $use_mobile_sidebar, 'skin_dir' => $skin_dir, 'mobile_skin_dir' => $mobile_skin_dir, 'page_title' => $page_title, 'meta_description' => $meta_description, 'meta_keywords' => $meta_keywords, 'meta_author' => $meta_author, 'page_name' => $page_name);
     $view['layout'] = $this->managelayout->front($layoutconfig, $this->cbconfig->get_device_view_type());
     $this->data = $view;
     $this->layout = element('layout_skin_file', element('layout', $view));
     $this->view = element('view_skin_file', element('layout', $view));
 }
Пример #14
0
 /**
  * Callback From: login()
  *
  * @param string $email The Email address to validate
  *
  * @return bool
  */
 public function _check_login($email)
 {
     if ($this->ion_auth->login($email, $this->input->post('password'), (bool) $this->input->post('remember'))) {
         Events::trigger('post_admin_login');
         return true;
     }
     $this->form_validation->set_message('_check_login', $this->ion_auth->errors());
     return false;
 }
Пример #15
0
 private function _mailToSaleDepartment($orderDetail)
 {
     $this->ci->load->model('users/ion_auth_model');
     $users = $this->ci->ion_auth_model->get_active_users('sale')->result();
     if (!empty($users)) {
         foreach ($users as $user) {
             $array = Events::trigger('email', array('slug' => 'mail-to-sale-deparment', 'to' => $user->email, 'name' => $user->first_name . $user->last_name, 'order_id' => sprintf('#%s', $orderDetail->order_number)), 'array');
         }
     }
     return;
 }
Пример #16
0
 public function __construct()
 {
     Events::trigger('before_controller', get_class($this));
     parent::__construct();
     $this->lang->load('application');
     $this->load->database();
     $this->load->driver('cache', array('adapter' => 'file'));
     $this->previous_page = $this->session->userdata('previous_page');
     $this->requested_page = $this->session->userdata('requested_page');
     // Pre-Controller Event
     Events::trigger('after_controller_constructor', get_class($this));
 }
 public function index($data = array())
 {
     if (!is_array($data)) {
         $data = array();
     }
     if (isset($data['contact_form_name']) && isset($data['contact_form_email'])) {
         $data['to'] = name_email_format($data['contact_form_name'], $data['contact_form_email']);
         $data['reply_to'] = name_email_format($this->settings->lang('site_name'), $this->settings->get('contact_email'));
         $data['subject'] = '[' . $this->settings->lang('site_name') . ': ' . $this->lang->line('mailer_confirmation_for_a_received_message') . '] ' . $data['contact_form_subject'];
     }
     return (bool) Events::trigger('email', $data);
 }
Пример #18
0
 function process($hash, $interval_string = FALSE)
 {
     if ($hash == $this->config->item('hash')) {
         if ($interval_string !== FALSE) {
             // Make array
             $intervals = explode('-', $interval_string);
             // Trigger a login event for each passed interval
             foreach ($intervals as $interval) {
                 Events::trigger('cron_process_' . $interval);
             }
         }
     }
 }
Пример #19
0
 /**
  * 관리자 메인 페이지입니다
  */
 public function index()
 {
     // 이벤트 라이브러리를 로딩합니다
     $eventname = 'event_admin_main_index';
     $this->load->event($eventname);
     $view = array();
     $view['view'] = array();
     // 이벤트가 존재하면 실행합니다
     $view['view']['event']['before'] = Events::trigger('before', $eventname);
     $view['view']['latest_member'] = $this->Member_model->get_admin_list(7, '', '', '', 'mem_id', 'desc', '', '');
     if (isset($view['view']['latest_member']['list']) && is_array($view['view']['latest_member']['list'])) {
         foreach ($view['view']['latest_member']['list'] as $key => $val) {
             $view['view']['latest_member']['list'][$key]['display_name'] = display_username(element('mem_userid', $val), element('mem_nickname', $val));
         }
     }
     $view['view']['latest_point'] = $this->Point_model->get_admin_list(7, '', '', '', 'poi_id', 'desc', '', '');
     if (isset($view['view']['latest_point']['list']) && is_array($view['view']['latest_point']['list'])) {
         foreach ($view['view']['latest_point']['list'] as $key => $val) {
             $view['view']['latest_point']['list'][$key]['display_name'] = display_username(element('mem_userid', $val), element('mem_nickname', $val));
         }
     }
     $view['view']['latest_post'] = $this->Post_model->get_admin_list(7, '', '', '', 'post_id', 'desc', '', '');
     if (isset($view['view']['latest_post']['list']) && is_array($view['view']['latest_post']['list'])) {
         foreach ($view['view']['latest_post']['list'] as $key => $val) {
             $brd_key = $this->board->item_id('brd_key', element('brd_id', $val));
             $view['view']['latest_post']['list'][$key]['post_url'] = post_url($brd_key, element('post_id', $val));
             $view['view']['latest_post']['list'][$key]['display_name'] = display_username(element('post_userid', $val), element('post_nickname', $val));
         }
     }
     $view['view']['latest_comment'] = $this->Comment_model->get_admin_list(7, '', '', '', 'cmt_id', 'desc', '', '');
     if (isset($view['view']['latest_comment']['list']) && is_array($view['view']['latest_comment']['list'])) {
         foreach ($view['view']['latest_comment']['list'] as $key => $val) {
             $post = $this->Post_model->get_one(element('post_id', $val), 'brd_id');
             $brd_key = $this->board->item_id('brd_key', element('brd_id', $post));
             $view['view']['latest_comment']['list'][$key]['post_url'] = post_url($brd_key, element('post_id', $val)) . '#comment_' . element('cmt_id', $val);
             $view['view']['latest_comment']['list'][$key]['display_name'] = display_username(element('cmt_userid', $val), element('cmt_nickname', $val));
         }
     }
     // 이벤트가 존재하면 실행합니다
     $view['view']['event']['before_layout'] = Events::trigger('before_layout', $eventname);
     /**
      * 어드민 레이아웃을 정의합니다
      */
     $layoutconfig = array('layout' => 'layout', 'skin' => 'main');
     $view['layout'] = $this->managelayout->admin($layoutconfig, $this->cbconfig->get_device_view_type());
     $this->data = $view;
     $this->layout = element('layout_skin_file', element('layout', $view));
     $this->view = element('view_skin_file', element('layout', $view));
 }
Пример #20
0
 public function __construct()
 {
     Events::trigger('before_controller', get_class($this));
     parent::__construct();
     // Dev Bar?
     if (ENVIRONMENT == 'development') {
         $this->load->library('Console');
         if (!$this->input->is_cli_request() && config_item('site.show_profiler')) {
             $this->output->enable_profiler(true);
         }
     }
     $this->lang->load('application');
     $this->load->driver('cache', array('adapter' => 'file'));
     // Pre-Controller Event
     Events::trigger('after_controller_constructor', get_class($this));
 }
Пример #21
0
 public function __construct()
 {
     Events::trigger('before_controller', get_class($this));
     parent::__construct();
     $this->lang->load('application');
     $this->load->driver('cache', array('adapter' => 'file'));
     $this->previous_page = $this->session->userdata('previous_page');
     $this->requested_page = $this->session->userdata('requested_page');
     // check if the app is installed
     $site_title = config_item('site.title');
     if (empty($site_title)) {
         redirect('/install');
     }
     // Pre-Controller Event
     Events::trigger('after_controller_constructor', get_class($this));
 }
Пример #22
0
 public function create()
 {
     // Variables
     $skip = array('btnAction');
     $extra = array('return' => 'users/addresses/edit/-id-', 'success_message' => lang('faq:submit_success'), 'failure_message' => lang('faq:submit_failure'));
     // Get the stream
     $this->data->mode = 'new';
     $this->data->stream = $this->streams->streams->get_stream('firesale_addresses', 'firesale_addresses');
     $this->data->fields = $this->fields->build_form($this->data->stream, 'new', $this->input->post(), FALSE, FALSE, $skip, $extra);
     $this->data->fields[0]['required'] = '<span>*</span>';
     // Add page content
     $this->template->title(lang('firesale:addresses:title'))->set_breadcrumb('Home', '/home')->set_breadcrumb(lang('firesale:addresses:title'), '/users/addresses')->set($this->data);
     // Fire events
     Events::trigger('page_build', $this->template);
     // Build page
     $this->template->build('address_create');
 }
Пример #23
0
    /**
     * The construct checks for authorization then loads in settings for
     * all of the admin controllers.
     *
     * @access	public
     * @return	void
     */
    public function __construct()
    {
        parent::__construct();
        $this->benchmark->mark('public_controller_start');
        Events::trigger('public_controller');
        // Check the frontend hasnt been disabled by an admin
        if (!$this->settings->frontend_enabled && (empty($this->current_user) or $this->current_user->group != 'admin')) {
            header('Retry-After: 600');
            $error = $this->settings->unavailable_message ? $this->settings->unavailable_message : lang('cms_fatal_error');
            show_error($error, 503);
        }
        // Load the current theme so we can set the assets right away
        ci()->theme = $this->theme_m->get();
        if (empty($this->theme->slug)) {
            show_error('This site has been set to use a theme that does not exist. If you are an administrator please ' . anchor('admin/themes', 'change the theme') . '.');
        }
        // Set the theme as a path for Asset library
        Asset::add_path('theme', $this->theme->path . '/');
        Asset::set_path('theme');
        // Support CDN URL's like Amazon CloudFront
        //		if (Settings::get('cdn_domain')) {
        //			$protocol = (!empty($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) !== 'off') ? 'https' : 'http';
        //			Asset::set_url($protocol . '://' . rtrim(Settings::get('cdn_domain'), '/') . '/');
        //		}
        // Set the theme view folder
        $this->template->set_theme($this->theme->slug)->append_metadata('
				<script type="text/javascript">
					var APPPATH_URI = "' . APPPATH_URI . '";
					var BASE_URI = "' . BASE_URI . '";
				</script>');
        // Is there a layout file for this module?
        if ($this->template->layout_exists($this->module . '.html')) {
            $this->template->set_layout($this->module . '.html');
        } elseif ($this->template->layout_exists('default.html')) {
            $this->template->set_layout('default.html');
        }
        // Make sure whatever page the user loads it by, its telling search robots the correct formatted URL
        //		$this -> template -> set_metadata('canonical', site_url($this -> uri -> uri_string()), 'link');
        // grab the theme options if there are any
        //		$this -> theme -> options = $this -> appcache -> model('theme_m', 'get_values_by', array( array('theme' => $this -> theme -> slug)));
        //		$this -> template -> settings = $this -> settings -> get_all();
        $this->template->server = $_SERVER;
        $this->template->theme = $this->theme;
        //		$this -> benchmark -> mark('public_controller_end');
    }
Пример #24
0
 /**
  * phpinfo 페이지입니다
  */
 public function index()
 {
     // 이벤트 라이브러리를 로딩합니다
     $eventname = 'event_admin_config_phpinfo_index';
     $this->load->event($eventname);
     $view = array();
     $view['view'] = array();
     // 이벤트가 존재하면 실행합니다
     $view['view']['event']['before'] = Events::trigger('before', $eventname);
     /**
      * 어드민 레이아웃을 정의합니다
      */
     $layoutconfig = array('skin' => 'index');
     $view['layout'] = $this->managelayout->admin($layoutconfig, $this->cbconfig->get_device_view_type());
     $this->data = $view;
     $this->layout = false;
     $this->view = element('view_skin_file', element('layout', $view));
 }
 public function index($data = array())
 {
     if (!is_array($data)) {
         $data = $data !== null ? array('to' => (string) $data) : array();
     }
     $custom_text = isset($data['custom_text']) ? $data['custom_text'] : null;
     extract($this->get_message($custom_text));
     $logo = FCPATH . 'apple-touch-icon-precomposed.png';
     $has_logo = file_exists($logo);
     $body = $this->parser->parse_string($body, array('has_logo' => $has_logo, 'logo_src' => 'cid:logo_src'), true, 'mustache');
     $attach = array();
     if ($has_logo) {
         $attach[] = array('file' => $logo, 'disposition' => 'inline', 'embedded_image' => true, 'key' => 'logo_src');
     }
     $this->load->library('email');
     $body = $this->email->full_html($subject, $body);
     $data = array_merge($data, compact('subject', 'body', 'attach'));
     return Events::trigger('email', $data);
 }
Пример #26
0
 public function sendRedirect($location)
 {
     if (headers_sent()) {
         throw new RequestException('Cannot send redirect when headers already sent');
     }
     $location = $this->resolveURI($location);
     $this->Logger->info("Sent Redirect to {$location} [STATUS: {$this->sc}]");
     $this->setProtocol($this->sc);
     $this->prepareResponse();
     /*
      * the response should not be ending the flow but it does, for now.
      * this is a hack to get around scattered use of the response singleton
      * through CF app and plugins.
      */
     $this->Events->trigger('Dispatcher.terminate', new Transport());
     header("Location: " . $location);
     header("Connection: close");
     exit;
 }
 public function index()
 {
     $this->output->set_header('Content-Type: application/json; charset=utf-8');
     $success = false;
     $messages = array();
     $settings = $this->settings->get(array('contact_form_has_phone', 'contact_form_phone_required', 'contact_form_has_organization', 'contact_form_organization_required'));
     extract($settings);
     if (!$contact_form_has_phone) {
         $contact_form_phone_required = false;
     }
     if (!$contact_form_has_organization) {
         $contact_form_organization_required = false;
     }
     $data = $this->input->post();
     if (!empty($data)) {
         if ($this->settings->get('mailer_enabled')) {
             $validation_rules = array(array('field' => 'contact_form_first_name', 'label' => 'lang:contact_first_name', 'rules' => 'nohtml|trim|required'), array('field' => 'contact_form_last_name', 'label' => 'lang:contact_last_name', 'rules' => 'nohtml|trim|required'), array('field' => 'contact_form_email', 'label' => 'lang:contact_email', 'rules' => 'nohtml|trim|required|valid_email'), array('field' => 'contact_form_phone', 'label' => 'lang:contact_phone', 'rules' => 'nohtml|trim' . ($contact_form_phone_required ? '|required' : '')), array('field' => 'contact_form_organization', 'label' => 'lang:contact_organization', 'rules' => 'nohtml|trim' . ($contact_form_organization_required ? '|required' : '')), array('field' => 'contact_form_subject', 'label' => 'lang:contact_subject', 'rules' => 'nohtml|trim|required'), array('field' => 'contact_form_message', 'label' => 'lang:contact_message', 'rules' => 'nohtml|trim|required|min_length[15]'), array('field' => 'contact_form_captcha', 'label' => 'Captcha', 'rules' => 'nohtml|trim|callback__captcha'));
             $this->form_validation->set_rules($validation_rules);
             if ($this->form_validation->run()) {
                 $data = $this->_prepare_data($data);
                 $data = $this->_load_email_template($data);
                 $data = $this->_create_email($data);
                 $success = (bool) Events::trigger('email', $data);
                 if ($success) {
                     $messages[] = $this->lang->line('mailer_your_message_has_been_sent');
                     Events::trigger('contact_form_submitted', $data);
                 } else {
                     $messages[] = $this->lang->line('mailer_error');
                 }
             } elseif (validation_errors_array()) {
                 $messages = validation_errors_array();
             } else {
                 $messages[] = 'Validation error.';
             }
         } else {
             $messages[] = $this->lang->line('mailer_disabled_error');
         }
     }
     $messages_html = $this->_prepare_messages_html($success, $messages);
     $this->captcha->clear();
     $this->output->set_output(json_encode(compact('success', 'messages', 'messages_html')));
 }
Пример #28
0
 function settings()
 {
     $this->auth->restrict('crbs.configure.settings');
     $this->layout->add_breadcrumb(lang('settings'), 'configure/settings');
     if ($this->input->post()) {
         $this->form_validation->set_rules('school_name', 'School name', 'required|max_length[100]|trim')->set_rules('school_url', 'Website address', 'required|max_length[255]|prep_url|trim')->set_rules('timetable_view', 'Timetable view', 'required')->set_rules('timetable_cols', 'Timteable columns', 'required');
         if ($this->form_validation->run()) {
             $options = array('school_name' => $this->input->post('school_name'), 'school_url' => $this->input->post('school_url'), 'timetable_view' => $this->input->post('timetable_view'), 'timetable_cols' => $this->input->post('timetable_cols'));
             if ($this->options_model->set($options)) {
                 $this->flash->set('success', 'Settings have been updated successfully.', TRUE);
                 Events::trigger('settings_general_update', array('options' => $options));
                 redirect(current_url());
             } else {
                 $this->flash->set('error', 'The settings could not be updated. Please try again.');
             }
         }
     }
     $this->load->library('form');
     $this->data['settings'] = $this->options_model->get_all(TRUE);
 }
Пример #29
0
 public function update()
 {
     // 이벤트 라이브러리를 로딩합니다
     $eventname = 'event_admin_config_browscapupdate_update';
     $this->load->event($eventname);
     // 이벤트가 존재하면 실행합니다
     Events::trigger('before', $eventname);
     $dir = FCPATH . 'plugin/browscap';
     if (!(is_readable($dir) && is_writeable($dir))) {
         exit(json_encode(array('success' => 'no', 'message' => 'plugin/browscap 경로가 파일쓰기가 금지되어있습니다. 퍼미션 확인 후에 다시 실행바랍니다')));
     }
     ini_set('memory_limit', '-1');
     require_once FCPATH . 'plugin/browscap/Browscap.php';
     $browscap = new phpbrowscap\Browscap($dir);
     $browscap->updateMethod = 'cURL';
     $browscap->cacheFilename = 'browscap_cache.php';
     $browscap->updateCache();
     // 이벤트가 존재하면 실행합니다
     Events::trigger('after', $eventname);
     exit(json_encode(array('success' => 'ok', 'message' => 'Browscap 업데이트가 완료되었습니다')));
 }
Пример #30
0
 /**
  * Class constructor
  *
  */
 public function __construct()
 {
     $this->autoload['libraries'][] = 'ui/contexts';
     parent::__construct();
     // Pagination config
     $this->pager = array('full_tag_open' => '<div class="pagination pagination-right"><ul>', 'full_tag_close' => '</ul></div>', 'next_link' => '&rarr;', 'prev_link' => '&larr;', 'next_tag_open' => '<li>', 'next_tag_close' => '</li>', 'prev_tag_open' => '<li>', 'prev_tag_close' => '</li>', 'first_tag_open' => '<li>', 'first_tag_close' => '</li>', 'last_tag_open' => '<li>', 'last_tag_close' => '</li>', 'cur_tag_open' => '<li class="active"><a href="#">', 'cur_tag_close' => '</a></li>', 'num_tag_open' => '<li>', 'num_tag_close' => '</li>');
     $this->limit = $this->settings_lib->item('site.list_limit');
     /*        // load the keyboard shortcut keys
             $shortcut_data = array(
                 'shortcuts' => config_item('ui.current_shortcuts'),
                 'shortcut_keys' => $this->settings_lib->find_all_by('module', 'core.ui'),
             );
             Template::set('shortcut_data', $shortcut_data);*/
     Events::trigger('before_front_controller');
     $this->load->library('template');
     $this->load->library('assets');
     $this->set_current_user();
     Events::trigger('after_front_controller');
     // Basic setup
     Template::set_theme($this->config->item('template.default_theme'));
 }