Ejemplo n.º 1
0
 /**
  * Constructor
  *
  * @return void
  */
 public function __construct()
 {
     parent::__construct();
     $this->auth->restrict('Bonfire.Database.Manage');
     $this->lang->load('database');
     $this->backup_folder = APPPATH . $this->backup_folder;
     Assets::add_module_css('database', 'database');
     Template::set_block('sub_nav', 'developer/_sub_nav');
 }
Ejemplo n.º 2
0
 public function __construct()
 {
     parent::__construct();
     $this->auth->restrict('Site.Reports.View');
     $this->auth->restrict('Bonfire.Activities.Manage');
     $this->lang->load('activities');
     Template::set('toolbar_title', lang('activity_title'));
     Assets::add_module_js('activities', 'jquery.dataTables.min.js');
     Assets::add_module_css('activities', 'datatable.css');
 }
Ejemplo n.º 3
0
 public function __construct()
 {
     parent::__construct();
     $this->auth->restrict('Site.Settings.View');
     $this->auth->restrict('Bonfire.Roles.Manage');
     $this->load->model('role_model');
     $this->lang->load('roles');
     Assets::add_js($this->load->view('settings/roles_js', null, true), 'inline');
     Assets::add_module_js('roles', 'js/settings.js');
     Assets::add_module_css('roles', 'css/settings.css');
 }
Ejemplo n.º 4
0
 /**
  * Setup the permissions and load the language file
  *
  * @return void
  */
 public function __construct()
 {
     parent::__construct();
     $this->auth->restrict('Site.Developer.View');
     $this->auth->restrict('Bonfire.Database.Manage');
     // Load the database lang file because Migrations is on the database subnav
     $this->lang->load('database/database');
     $this->lang->load('migrations');
     $this->load->library('Migrations');
     Assets::add_module_css('migrations', 'migrations');
     Template::set_block('sub_nav', 'database/developer/_sub_nav');
 }
Ejemplo n.º 5
0
 public function __construct()
 {
     parent::__construct();
     $this->auth->restrict('Site.Settings.View');
     $this->auth->restrict('Bonfire.Roles.Manage');
     $this->load->model('role_model');
     $this->lang->load('roles');
     Assets::add_module_css('roles', 'css/settings.css');
     // for the render_search_box()
     $this->load->helper('ui/ui');
     Assets::add_js('js/jquery.tablehover.pack.js');
 }
Ejemplo n.º 6
0
 /**
  * Constructor - Load required classes
  *
  * @return void
  */
 public function __construct()
 {
     parent::__construct();
     // Restrict access - View and Manage
     $this->auth->restrict('Bonfire.Translate.View');
     $this->auth->restrict('Bonfire.Translate.Manage');
     $this->lang->load('translate');
     $this->load->helper('languages');
     $this->langs = list_languages();
     Assets::add_module_js('translate', 'translate.js');
     Assets::add_module_css('translate', 'translate.css');
     Template::set_block('sub_nav', 'developer/_sub_nav');
 }
Ejemplo n.º 7
0
 /**
  * Setup the permissions and load the language file
  *
  * @return void
  */
 public function __construct()
 {
     parent::__construct();
     $this->auth->restrict('Site.Developer.View');
     $this->auth->restrict('Bonfire.Logs.View');
     $this->lang->load('logs');
     Assets::add_module_js('logs', 'logs');
     Assets::add_module_css('logs', 'logs');
     // Logging enabled?
     Template::set('log_threshold', $this->config->item('log_threshold'));
     Template::set('toolbar_title', lang('logs_title'));
     Template::set_block('sub_nav', 'developer/_sub_nav');
 }
Ejemplo n.º 8
0
 /**
  * Setup the required permissions and load required classes
  *
  * @return void
  */
 public function __construct()
 {
     parent::__construct();
     $this->auth->restrict($this->permissionContext);
     $this->auth->restrict($this->permissionView);
     $this->load->model('role_model');
     $this->lang->load('roles');
     Assets::add_module_css('roles', 'css/settings.css');
     Assets::add_js('codeigniter-csrf.js');
     Assets::add_module_js('roles', 'jquery.tablehover.pack.js');
     Assets::add_module_js('roles', 'js/settings.js');
     // For the render_search_box()
     $this->load->helper('ui/ui');
     Template::set_block('sub_nav', 'settings/_sub_nav');
 }
Ejemplo n.º 9
0
 /**
  * Setup restrictions and load configs, libraries and language files
  *
  * @return void
  */
 public function __construct()
 {
     parent::__construct();
     $this->auth->restrict('Site.Developer.View');
     $this->lang->load('builder');
     $this->load->config('modulebuilder');
     $this->options = $this->config->item('modulebuilder');
     if (isset($this->options['form_error_delimiters']) && is_array($this->options['form_error_delimiters']) && count($this->options['form_error_delimiters']) == 2) {
         $this->form_validation->set_error_delimiters($this->options['form_error_delimiters'][0], $this->options['form_error_delimiters'][1]);
     }
     Assets::add_module_css('builder', 'builder.css');
     Assets::add_module_js('builder', 'modulebuilder.js');
     Template::set_block('sub_nav', 'developer/_sub_nav');
     Template::set_block('sidebar', 'developer/sidebar');
 }
Ejemplo n.º 10
0
 public function article($article_id = false)
 {
     if ($article_id === false) {
         return false;
     }
     Assets::add_module_css('news', 'news.css');
     if (($article = $this->news_model->get_article($article_id)) !== false) {
         $this->load->library('users/auth');
         $article->author_name = $this->auth->username($article->author);
         $settings = $this->settings_lib->find_all_by('module', 'news');
         $article->asset_url = $settings['news.upload_dir_url'];
         Template::set('article', $article);
     } else {
         $this->activity_model->log_activity($this->auth->user_id(), 'Get Article: ' . $article_id . ' failed. no article found.', 'news');
     }
     Template::set_view('news/index');
     Template::render();
 }
Ejemplo n.º 11
0
 public function create()
 {
     Assets::clear_cache();
     Assets::add_module_js('pembayaran', 'pembayaran');
     Assets::add_module_js('jumlah_pembayaran.js');
     Assets::add_module_css('pembayaran', 'auto');
     $this->auth->restrict('Pembayaran.Keuangan.Create');
     if ($this->input->post('save')) {
         if ($insert_id = $this->save_pembayaran()) {
             // Log the activity
             $this->activity_model->log_activity($this->current_user->id, lang('pembayaran_act_create_record') . ': ' . $insert_id . ' : ' . $this->input->ip_address(), 'pembayaran');
             Template::set_message(lang('pembayaran_create_success'), 'success');
             Template::redirect(SITE_AREA . '/keuangan/pembayaran/index/' . $this->input->post('nim'));
         } else {
             Template::set_message(lang('pembayaran_create_failure') . $this->pembayaran_model->error, 'error');
         }
     }
     Template::set('toolbar_title', 'Masukan Data Pembayaran Mahasiswa');
     Template::render();
 }
Ejemplo n.º 12
0
 /**
  * Allows the user to create a new password for their account. At the moment,
  * the only way to get here is to go through the forgot_password() process,
  * which creates a unique code that is only valid for 24 hours.
  *
  * Since 0.7 this method is also reached via the force_password_reset security
  * features.
  *
  * @param string $email The email address to check against.
  * @param string $code  A randomly generated alphanumeric code. (Generated by
  * forgot_password()).
  *
  * @return void
  */
 public function reset_password($email = '', $code = '')
 {
     Assets::add_module_css('users', 'login.css');
     // If the user is logged in, go home.
     if ($this->auth->is_logged_in() !== false) {
         Template::redirect('/');
     }
     // Bonfire may have stored the email and code in the session.
     if (empty($code) && $this->session->userdata('pass_check')) {
         $code = $this->session->userdata('pass_check');
     }
     if (empty($email) && $this->session->userdata('email')) {
         $email = $this->session->userdata('email');
     }
     // If there is no code/email, then it's not a valid request.
     if (empty($code) || empty($email)) {
         Template::set_message(lang('us_reset_invalid_email'), 'error');
         Template::redirect(LOGIN_URL);
     }
     // Handle the form
     if (isset($_POST['set_password'])) {
         $this->form_validation->set_rules('password', 'lang:bf_password', 'required|max_length[120]|valid_password');
         $this->form_validation->set_rules('pass_confirm', 'lang:bf_password_confirm', 'required|matches[password]');
         if ($this->form_validation->run() !== false) {
             // The user model will create the password hash.
             $data = array('password' => $this->input->post('password'), 'reset_by' => 0, 'reset_hash' => '', 'force_password_reset' => 0);
             if ($this->user_model->update($this->input->post('user_id'), $data)) {
                 log_activity($this->input->post('user_id'), lang('us_log_reset'), 'users');
                 // Now send the email
                 $this->load->library('emailer/emailer');
                 $data = array('to' => $this->user_model->find($this->input->post('user_id'))->email, 'variables' => array(array('name' => 'SITE_URL', 'content' => site_url()), array('name' => 'SITETITLE', 'content' => $this->settings_lib->item('site.title')), array('name' => 'LOGIN_LINK', 'content' => site_url() . '/login')), 'template_name' => 'FORGOT_PASSWORD_SUCCESS');
                 $this->emailer->send($data);
                 Template::set_message(lang('us_reset_password_success'), 'success');
                 Template::redirect(LOGIN_URL);
             }
             if (!empty($this->user_model->error)) {
                 Template::set_message(sprintf(lang('us_reset_password_error'), $this->user_model->error), 'error');
             }
         }
     }
     Assets::add_js($this->load->view('user_register_js', array('settings' => $this->siteSettings), true), 'inline');
     // Check the code against the database
     $email = str_replace(':', '@', $email);
     $user = $this->user_model->find_by(array('email' => $email, 'reset_hash' => $code, 'reset_by >=' => time()));
     // $user will be an Object if a single result was returned.
     if (!is_object($user)) {
         Template::set_message(lang('us_reset_invalid_email'), 'error');
         Template::redirect(LOGIN_URL);
     }
     // At this point, it is a valid request....
     Template::set('user', $user);
     Template::set_view('users/reset_password');
     Template::render();
 }
Ejemplo n.º 13
0
 /**
  *	article.
  *
  *	A funtion that renders an article using the news article template via the Bonire Template::render() function. 
  *	Unlike get_articles, this function also includes the News social sharing bar if that options is enabled.
  *
  *	@param	$article_id		int		The News article ID
  *	@return					<void>	This function outputs to the Template::render() function
  *
  */
 public function article($article_id = false)
 {
     if ($article_id === false) {
         return false;
     }
     $settings = $this->_settings;
     Assets::add_module_css('news', 'news.css');
     if (($article = $this->news_model->get_article($article_id)) !== false) {
         $this->load->helper('author');
         $article->author_name = find_author_name($article->author);
         $article->asset_url = $settings['news.upload_dir_url'];
         Template::set('article', $article);
         if (isset($settings['news.sharing_enabled']) && $settings['news.sharing_enabled'] == 1) {
             Template::set('settings', $settings);
             Template::set('single', true);
             Template::set('scripts', $this->load->view('news/news_articles_js', null, true));
         }
         // COMMENTS
         $comments = in_array('comments', module_list(true)) && $settings['news.comments_enabled'] == 1 ? modules::run('comments/thread_view_with_form', $article->comments_thread_id) : '';
         Template::set('comment_form', $comments);
     } else {
         $this->activity_model->log_activity($this->current_user->id, 'Get Article: ' . $article_id . ' failed. no article found.', 'news');
     }
     Template::set_view('news/article');
     Template::render();
 }