Example #1
0
 public function _remap($method)
 {
     if (!$this->config->item('allow_forgotten_password', 'fuel')) {
         show_404();
     }
     $this->load->library('session');
     $this->load->helper('string');
     $this->load->module_model(FUEL_FOLDER, 'fuel_users_model');
     $this->load->module_language(FUEL_FOLDER, 'fuel');
     $email = fuel_uri_segment(2);
     $reset_key = fuel_uri_segment(3);
     $user = $this->fuel_users_model->find_one('MD5(email) = "' . $email . '" AND MD5(reset_key) = "' . $reset_key . '"');
     if (isset($user->id)) {
         $new_pwd = random_string('alnum', 8);
         $user->password = $new_pwd;
         $user->reset_key = '';
         if ($user->save()) {
             $params['to'] = $user->email;
             $params['subject'] = lang('pwd_reset_subject_success');
             $params['message'] = lang('pwd_reset_email_success', $new_pwd);
             $params['use_dev_mode'] = FALSE;
             if ($this->fuel->notification->send($params)) {
                 $this->session->set_flashdata('success', lang('pwd_reset_success'));
                 $this->fuel->logs->write(lang('auth_log_pass_reset', $user->user_name, $this->input->ip_address()), 'debug');
             } else {
                 $this->session->set_flashdata('error', $this->email->print_debugger());
             }
         } else {
             $this->session->set_flashdata('error', lang('error_pwd_reset'));
         }
     } else {
         $this->session->set_flashdata('error', lang('error_pwd_reset'));
     }
     redirect(fuel_url('login'));
 }
Example #2
0
 function tree($just_published = FALSE)
 {
     $CI =& get_instance();
     $CI->load->helper('array');
     $return = array();
     $where = array();
     if ($just_published) {
         $sql['where'] = array('published' => 'yes');
     }
     $pages = $this->find_all_array_assoc('location', $where, 'location asc');
     foreach ($pages as $key => $val) {
         $parts = explode('/', $val['location']);
         $label = array_pop($parts);
         $parent = implode('/', $parts);
         if (!empty($pages[$parent]) || strrpos($val['location'], '/') === FALSE) {
             $return[$key]['label'] = $label;
             $return[$key]['parent_id'] = empty($parent) ? 0 : $parent;
         } else {
             // if orphaned... then put them in the _orphans folder
             if (empty($return['_orphans'])) {
                 $return['_orphans'] = array('label' => '_orphans', 'parent_id' => 0, 'location' => null);
             }
             $return[$key]['label'] = $key;
             $return[$key]['parent_id'] = '_orphans';
         }
         if ($val['published'] == 'no') {
             $return[$key]['attributes'] = array('class' => 'unpublished', 'title' => 'unpublished');
         }
         $return[$key]['location'] = fuel_url('pages/edit/' . $val['id']);
     }
     $return = array_sorter($return, 'label', 'asc');
     return $return;
 }
Example #3
0
	function tree()
	{
		$CI =& get_instance();
		$CI->load->model('categories_model');
		$CI->load->model('categories_to_articles_model');

		$return = array();
		$categories = $CI->categories_model->find_all(array(), 'id asc');
		$categories_to_articles = $CI->categories_to_articles_model->find_all('', 'categories.name asc');

		$cat_id = -1;
		foreach($categories as $category)
		{
			$cat_id = $category->id;
			$return[] = array('id' => $category->id, 'label' => $category->name, 'parent_id' => 0, 'location' => fuel_url('categories/edit/'.$category->id));
		}
		$i = $cat_id +1;

		foreach($categories_to_articles as $val)
		{
			$attributes = ($val->published == 'no') ? array('class' => 'unpublished', 'title' => 'unpublished') : NULL;
			$return[$i] = array('id' => $i, 'label' => $val->title, 'parent_id' => $val->category_id, 'location' => fuel_url('articles/edit/'.$val->article_id), 'attributes' =>  $attributes);
			$i++;
		}
		return $return;
	}
 public function upload()
 {
     $this->load->library('form_builder');
     $this->load->module_model(FUEL_FOLDER, 'fuel_navigation_groups_model');
     $this->load->module_model(FUEL_FOLDER, 'fuel_navigation_model');
     $this->js_controller_params['method'] = 'upload';
     if (!empty($_POST)) {
         $params = $this->input->post();
         if (!empty($_FILES['file']['name'])) {
             $error = FALSE;
             $file_info = $_FILES['file'];
             $params['file_path'] = $file_info['tmp_name'];
             $params['var'] = $this->input->post('variable') ? $this->input->post('variable', TRUE) : 'nav';
             $params['language'] = $this->input->post('language', TRUE);
             if (!$this->fuel->navigation->upload($params)) {
                 $error = TRUE;
             }
             if ($error) {
                 add_error(lang('error_upload'));
             } else {
                 // change list view page state to show the selected group id
                 $this->fuel->admin->set_notification(lang('navigation_success_upload'), Fuel_admin::NOTIFICATION_SUCCESS);
                 redirect(fuel_url('navigation?group_id=' . $params['group_id']));
             }
         } else {
             add_error(lang('error_upload'));
         }
     }
     $fields = array();
     $nav_groups = $this->fuel_navigation_groups_model->options_list('id', 'name', array('published' => 'yes'), 'id asc');
     if (empty($nav_groups)) {
         $nav_groups = array('1' => 'main');
     }
     // load custom fields
     $this->form_builder->load_custom_fields(APPPATH . 'config/custom_fields.php');
     $fields['group_id'] = array('type' => 'select', 'options' => $nav_groups, 'module' => 'navigation_group');
     $fields['file'] = array('type' => 'file', 'accept' => '');
     $fields['variable'] = array('label' => 'Variable', 'value' => $this->input->post('variable') ? $this->input->post('variable', TRUE) : 'nav', 'size' => 10);
     $fields['language'] = array('type' => 'select', 'options' => $this->fuel->language->options(), 'first_option' => lang('label_select_one'));
     $fields['clear_first'] = array('type' => 'enum', 'options' => array('yes' => 'yes', 'no' => 'no'));
     $fields['__fuel_module__'] = array('type' => 'hidden');
     $fields['__fuel_module__']['value'] = $this->module;
     $fields['__fuel_module__']['class'] = '__fuel_module__';
     $fields['__fuel_module_uri__'] = array('type' => 'hidden');
     $fields['__fuel_module_uri__']['value'] = $this->module_uri;
     $fields['__fuel_module_uri__']['class'] = '__fuel_module_uri__';
     $this->form_builder->set_fields($fields);
     $this->form_builder->submit_value = '';
     $this->form_builder->use_form_tag = FALSE;
     $this->form_builder->set_field_values($_POST);
     $vars['instructions'] = lang('navigation_import_instructions');
     $vars['form'] = $this->form_builder->render();
     $vars['back_action'] = ($this->fuel->admin->last_page() and $this->fuel->admin->is_inline()) ? $this->fuel->admin->last_page() : fuel_uri($this->module_uri);
     $crumbs = array($this->module_uri => $this->module_name, lang('action_upload'));
     $this->fuel->admin->set_titlebar($crumbs);
     $this->fuel->admin->render('upload', $vars, Fuel_admin::DISPLAY_NO_ACTION);
 }
	function tree($just_published = false)
	{
		$CI =& get_instance();
		$CI->load->helper('array');
		
		$data = array();

		$where = array();
		$group_id = (!empty($this->filters['group_id'])) ? $this->filters['group_id'] : $this->group_id;
		$where['group_id'] = $group_id;

		if ($just_published) $where['published'] =  'yes';
		$all_nav = $this->find_all_array_assoc('id', $where);

		$where = array();
		if (!empty($parent))
		{
			$parent = $this->find_one_array(array('location' => $parent));
			$where = array('group_id' => $group_id, 'parent_id' => $parent['id']);
		}
		else
		{
			$where = array('group_id' => $group_id);
		}
		$data = $this->find_all_array($where, 'precedence, location asc');
		$return = array();
		$i = 0;
		foreach($data as $key => $val)
		{
			$return[$key] = $val;

			if ($val['parent_id'] != 0) {
				if (empty($all_nav[$val['parent_id']]))
				{
					if (empty($return['_orphans']))
					{
						$return['_orphans'] = array('label' => '_orphans', 'parent_id' => 0, 'location' => null);
					}
					$return[$key]['parent_id'] = '_orphans';
				}
			}
			else
			{
				$return[$key]['parent_id'] = 0;
				
			}

			
			if ($val['published'] == 'no')
			{
				$return[$key]['attributes'] = array('class' => 'unpublished', 'title' => 'unpublished');
			}
			$return[$key]['location'] = fuel_url('navigation/edit/'.$val['id']);
		}
		//$return = array_sorter($return, 'label', 'asc');
		return $return;
	}
Example #6
0
 function _remap($module, $segs = NULL)
 {
     $remote_ips = $this->fuel->config('webhook_remote_ip');
     $is_web_hook = $this->fuel->auth->check_valid_ip($remote_ips);
     // check if it is CLI or a web hook otherwise we need to validate
     $validate = (php_sapi_name() == 'cli' or defined('STDIN') or $is_web_hook) ? FALSE : TRUE;
     // Only super admins can execute builds for now
     if ($validate and !$this->fuel->auth->is_super_admin()) {
         show_error(lang('error_no_access', fuel_url()));
     }
     // call before build hook
     $params = array('module' => $module);
     $GLOBALS['EXT']->_call_hook('before_build', $params);
     // get the type of build which can either be CSS or JS
     $type = array_shift($segs);
     $valid_types = array('css', 'js');
     if (!empty($type) and in_array($type, $valid_types)) {
         $this->load->helper('file');
         // get the folder name if it exists
         $segs_str = implode('/', $segs);
         // explode on colon to separate the folder name from the file name
         $seg_parts = explode(':', $segs_str);
         // set the folder name to lookin
         $folder = $seg_parts[0];
         // set the file name if one exists
         $filename = !empty($seg_parts[1]) ? $seg_parts[1] : 'main.min';
         // get list of files
         $files_path = assets_server_path($folder, $type);
         $_files = get_filenames($files_path, TRUE);
         $files = array();
         foreach ($_files as $file) {
             // trim to normalize path
             $replace = trim(assets_server_path('', $type), '/');
             $files[] = str_replace($replace, '', trim($file, '/'));
         }
         $output_params['type'] = $type;
         $output_params['whitespace'] = TRUE;
         $output_params['destination'] = assets_server_path($filename . '.' . $type, $type, $module);
         $output = $this->asset->optimize($files, $output_params);
         echo lang('module_build_asset', strtoupper($type), $output_params['destination']);
     } else {
         if ($module != 'index' and $this->fuel->modules->exists($module) and $this->fuel->modules->is_advanced($this->fuel->{$module})) {
             $results = $this->fuel->{$module}->build();
             if ($results === FALSE) {
                 echo lang('error_no_build');
             }
         } else {
             // run default FUEL optimizations if no module is passed
             $this->optimize_js();
             $this->optimize_css();
         }
     }
     // call after build hook
     $GLOBALS['EXT']->_call_hook('after_build', $params);
 }
 /**
  * Resets the page state for the current page by default
  *
  * @access	public
  * @param	string (optional)
  * @return	void
  */
 public function reset_page_state($state_key = NULL)
 {
     if (empty($state_key)) {
         $state_key = $this->fuel->admin->get_state_key();
     }
     if (!empty($state_key)) {
         $session_key = $this->fuel->auth->get_session_namespace();
         $user_data = $this->fuel->auth->user_data();
         $user_data['page_state'] = array();
         $this->session->set_userdata($session_key, $user_data);
         redirect(fuel_url($state_key));
     }
 }
 public function tree()
 {
     $CI =& get_instance();
     // first get the permissions
     $perms_list = $CI->fuel_permissions_model->find_all_array_assoc('name', array(), 'name asc');
     $perms = array();
     foreach ($perms_list as $perm => $perm_val) {
         $sub = explode('/', $perm);
         $parent_id = isset($sub[1]) ? $sub[0] : 0;
         $sub_attributes = $perm_val['active'] == 'no' ? array('class' => 'unpublished', 'title' => 'unpublished') : NULL;
         $perms[$perm] = array('label' => $perm_val['description'], 'parent_id' => $parent_id, 'location' => fuel_url('permissions/edit/' . $perm_val['id']), 'attributes' => $sub_attributes);
     }
     return $perms;
 }
 function tree($just_published = FALSE)
 {
     $CI =& get_instance();
     $CI->load->module_model(BLOG_FOLDER, 'blog_posts_model');
     $CI->load->helper('array');
     $return = array();
     $where = $just_published ? $where = array('published' => 'yes') : array();
     $comments = $this->find_all($where, 'title asc');
     foreach ($comments as $comment) {
         if (!isset($return[$comment->post_id])) {
             $return['p_' . $comment->post_id] = array('id' => 'p_' . $comment->post_id, 'label' => $comment->title, 'location' => fuel_url('blog/posts/edit/' . $comment->post_id));
         }
         $label = !empty($comment->author_name) ? $comment->author_name : $comment->author_email;
         $attributes = $comment->published == 'no' ? array('class' => 'unpublished', 'title' => 'unpublished') : NULL;
         $return['c_' . $comment->id] = array('id' => $comment->id, 'label' => $label, 'parent_id' => 'p_' . $comment->post_id, 'location' => fuel_url('blog/posts/edit/' . $comment->post_id), 'attributes' => $attributes);
     }
     $return = array_sorter($return, 'label', 'asc');
     return $return;
 }
Example #10
0
 function _remap($method)
 {
     if (!$this->config->item('allow_forgotten_password', 'fuel')) {
         show_404();
     }
     $this->load->library('session');
     $this->load->helper('string');
     $this->load->module_model(FUEL_FOLDER, 'users_model');
     $this->load->module_language(FUEL_FOLDER, 'fuel');
     $email = fuel_uri_segment(2);
     $reset_key = fuel_uri_segment(3);
     $user = $this->users_model->find_one('MD5(email) = "' . $email . '" AND MD5(reset_key) = "' . $reset_key . '"');
     if (isset($user->id)) {
         $new_pwd = random_string('alnum', 8);
         $user->password = $new_pwd;
         $user->reset_key = '';
         if ($user->save()) {
             $this->load->library('email');
             $config['wordwrap'] = TRUE;
             $this->email->initialize($config);
             $this->email->from($this->config->item('from_email', 'fuel'), $this->config->item('site_name', 'fuel'));
             $this->email->to($user->email);
             $this->email->subject(lang('pwd_reset_subject_success'));
             $msg = lang('pwd_reset_email_success', $new_pwd);
             $this->email->message($msg);
             if ($this->email->send()) {
                 $this->session->set_flashdata('success', lang('pwd_reset_success'));
             } else {
                 $this->session->set_flashdata('error', $this->email->print_debugger());
             }
         } else {
             exit('yo3');
             $this->session->set_flashdata('error', lang('error_pwd_reset'));
         }
     } else {
         $this->session->set_flashdata('error', lang('error_pwd_reset'));
     }
     redirect(fuel_url('login'));
 }
Example #11
0
 function tree($just_published = FALSE)
 {
     $CI =& get_instance();
     $CI->load->module_model(BLOG_FOLDER, 'blog_categories_model');
     $CI->load->module_model(FUEL_FOLDER, 'fuel_relationships_model');
     $CI->load->helper('array');
     $return = array();
     $where = $just_published ? $where = array('published' => 'yes') : array();
     $categories = $CI->blog_categories_model->find_all($where, 'precedence asc');
     $posts_to_categories = $CI->fuel_relationships_model->find_by_candidate($this->_tables['blog_posts'], $this->_tables['blog_categories']);
     if (empty($posts_to_categories)) {
         return array();
     }
     foreach ($categories as $category) {
         $return[$category->id] = array('id' => $category->id, 'parent_id' => 0, 'label' => $category->name, 'location' => fuel_url('blog/categories/edit/' . $category->id), 'precedence' => $category->precedence);
     }
     foreach ($posts_to_categories as $val) {
         $attributes = $val->candidate_published == 'no' ? array('class' => 'unpublished', 'title' => 'unpublished') : NULL;
         $return['p_' . $val->candidate_id . '_c' . $val->foreign_id] = array('label' => $val->candidate_title, 'parent_id' => $val->foreign_id, 'location' => fuel_url('blog/posts/edit/' . $val->candidate_id), 'attributes' => $attributes, 'precedence' => 100000);
     }
     $return = array_sorter($return, 'precedence', 'asc');
     return $return;
 }
Example #12
0
 function tree($just_published = FALSE)
 {
     $CI =& get_instance();
     $CI->load->module_model(BLOG_FOLDER, 'blog_categories_model');
     $CI->load->module_model(BLOG_FOLDER, 'blog_posts_to_categories_model');
     $CI->load->helper('array');
     $return = array();
     $where = $just_published ? $where = array('published' => 'yes') : array();
     $categories = $CI->blog_categories_model->find_all($where, 'id asc');
     $posts_to_categories = $CI->blog_posts_to_categories_model->find_all($where, 'title asc');
     if (empty($posts_to_categories)) {
         return array();
     }
     foreach ($categories as $category) {
         $return[$category->id] = array('id' => $category->id, 'parent_id' => 0, 'label' => $category->name, 'location' => fuel_url('blog/categories/edit/' . $category->id));
     }
     foreach ($posts_to_categories as $val) {
         $attributes = $val->published == 'no' ? array('class' => 'unpublished', 'title' => 'unpublished') : NULL;
         $return['p_' . $val->post_id] = array('label' => $val->title, 'parent_id' => $val->category_id, 'location' => fuel_url('blog/posts/edit/' . $val->post_id), 'attributes' => $attributes);
     }
     $return = array_sorter($return, 'parent_id', 'asc');
     return $return;
 }
 /**
  * Tree view that puts categories in a hierarchy based on their parent value
  *
  * @access	public
  * @param	boolean Determines whether to return just published pages or not (optional... and ignored in the admin)
  * @return	array An array that can be used by the Menu class to create a hierachical structure
  */
 public function tree($just_published = FALSE)
 {
     $return = array();
     $where = $just_published ? array('published' => 'yes') : array();
     $categories = $this->find_all_array($where);
     foreach ($categories as $category) {
         $attributes = (isset($category['published']) and $category['published'] == 'no') ? array('class' => 'unpublished', 'title' => 'unpublished') : NULL;
         $return[] = array('id' => $category['id'], 'label' => $category['name'], 'parent_id' => $category['parent_id'], 'location' => fuel_url('categories/edit/' . $category['id']), 'attributes' => $attributes);
     }
     return $return;
 }
Example #14
0
 public function upload($inline = FALSE)
 {
     $this->load->helper('file');
     $this->load->helper('security');
     $this->load->library('form_builder');
     $this->load->library('upload');
     $this->js_controller_params['method'] = 'upload';
     if (!empty($_POST) and !empty($_FILES)) {
         $params['upload_path'] = sys_get_temp_dir();
         $params['allowed_types'] = 'php|html|txt';
         // to ensure we check the proper mime types
         $this->upload->initialize($params);
         // Hackery to ensure that a proper php mimetype is set.
         // Would set in mimes.php config but that may be updated with the next version of CI which does not include the text/plain
         $this->upload->mimes['php'] = array('application/x-httpd-php', 'application/php', 'application/x-php', 'text/php', 'text/x-php', 'application/x-httpd-php-source', 'text/plain');
         if ($this->upload->do_upload('file')) {
             $upload_data = $this->upload->data();
             $error = FALSE;
             // read in the file so we can filter it
             $file = read_file($upload_data['full_path']);
             // sanitize the file before saving
             $file = $this->_sanitize($file);
             $id = $this->input->post('id', TRUE);
             $name = $this->input->post('name', TRUE);
             $language = $this->input->post('language', TRUE);
             if (empty($name)) {
                 $name = current(explode('.', $file_info['name']));
             }
             if ($id) {
                 $save['id'] = $id;
             }
             $save['name'] = $name;
             $save['view'] = $file;
             $save['language'] = $language;
             $save['date_added'] = datetime_now();
             $save['last_modified'] = date('Y-m-d H:i:s', time() + 1);
             // to prevent window from popping up after upload
             $id = $this->model->save($save);
             if (!$id) {
                 add_error(lang('error_upload'));
             } else {
                 // change list view page state to show the selected group id
                 $this->fuel->admin->set_notification(lang('blocks_success_upload'), Fuel_admin::NOTIFICATION_SUCCESS);
                 redirect(fuel_url('blocks/edit/' . $id));
             }
         } else {
             $error_msg = $this->upload->display_errors('', '');
             add_error($error_msg);
         }
     }
     $fields = array();
     $blocks = $this->model->options_list('id', 'name', array('published' => 'yes'), 'name');
     $fields['name'] = array('label' => lang('form_label_name'), 'type' => 'inline_edit', 'options' => $blocks, 'module' => 'blocks');
     $fields['file'] = array('type' => 'file', 'accept' => '', 'required' => TRUE);
     $fields['id'] = array('type' => 'hidden');
     $fields['language'] = array('type' => 'hidden');
     $field_values = $_POST;
     $common_fields = $this->_common_fields($field_values);
     $fields = array_merge($fields, $common_fields);
     $this->form_builder->hidden = array();
     $this->form_builder->set_fields($fields);
     $this->form_builder->set_field_values($_POST);
     $this->form_builder->submit_value = '';
     $this->form_builder->use_form_tag = FALSE;
     $vars['instructions'] = lang('blocks_upload_instructions');
     $vars['form'] = $this->form_builder->render();
     $vars['back_action'] = ($this->fuel->admin->last_page() and $this->fuel->admin->is_inline()) ? $this->fuel->admin->last_page() : fuel_uri($this->module_uri);
     //$vars['back_action'] = fuel_uri($this->module_uri);
     $crumbs = array($this->module_uri => $this->module_name, lang('action_upload'));
     $this->fuel->admin->set_titlebar($crumbs);
     $this->fuel->admin->render('upload', $vars, Fuel_admin::DISPLAY_NO_ACTION);
 }
 /**
  * Returns a URL specific to the advanced module (e.g. http://localhost/fuel/{advanced_module}/create)
  *
  * @access	public
  * @param	string	The URI path relative to the advanced module (optional)
  * @return	string
  */
 public function fuel_url($uri = '')
 {
     $uri = trim($uri, '/');
     return fuel_url($this->uri_path() . '/' . $uri);
 }
Example #16
0
?>
" alt="Layouts" /> <a href="<?php 
echo fuel_url('users');
?>
">Users &amp; Permissions</a></h2>
<p>FUEL CMS users are created in the users module in the admin. A single user can subscribe to as many permissions as necessary however, the permissions to manage users and permisisons
gives a user admin level control so use wisely. Furthermore, certain permissions may not be applicable to your setup.</p>

<h2 id="cache" class="ico ico_manage_cache"><img src="<?php 
echo img_path('icons/ico_page_lightning.png', 'fuel');
?>
" alt="Layouts" /> <a href="<?php 
echo fuel_url('manage/cache');
?>
">Page Cache</a></h2>
<p>FUEL CMS uses a cache to speed up the delivery of pages. Sometimes changes are made to static layouts or blocks and your changes may not be immediately reflected. This is most likely
related to the cache which can be <a href="<?php 
echo fuel_url('manage/cache');
?>
">cleared here</a>.</p>

<h2 id="settings" class="ico ico_settings"><img src="<?php 
echo img_path('icons/ico_table_gear.png', 'fuel');
?>
" alt="Layouts" /> <a href="<?php 
echo fuel_url('settings');
?>
">Settings</a></h2>
<p>Although it's unlikely you'll need to worry too much about this, some modules have extra configuration settings you can manage in the CMS. For example, you may have a blog settings area if the blog is installed.</p>

 /**
  * Returns a tree array structure that can be used by a public "tree" method on models inheriting from this class 
  *
  * @access	protected
  * @param	string The name of the model's property to use to generate the tree. Options are 'foreign_keys', 'has_many' or 'belongs_to'
  * @return	array An array that can be used by the Menu class to create a hierachical structure
  */
 protected function _tree($prop = NULL)
 {
     $CI =& get_instance();
     $return = array();
     if (!empty($this->foreign_keys) or !empty($this->has_many) or !empty($this->belongs_to)) {
         if (empty($prop)) {
             if (!empty($this->foreign_keys)) {
                 $p = $this->foreign_keys;
             } else {
                 if (!empty($this->has_many)) {
                     $p = $this->has_many;
                 }
             }
         } else {
             if (property_exists($this, $prop)) {
                 $p = $this->{$prop};
             }
         }
         $key_field = key($p);
         $loc_field = $key_field;
         // get related model info
         $rel_module = current($p);
         if (is_array($rel_module)) {
             $rel_module = current($rel_module);
         }
         $rel_module_obj = $CI->fuel->modules->get($rel_module, FALSE);
         if (!$rel_module_obj) {
             return array();
         }
         $rel_model = $rel_module_obj->model();
         $rel_key_field = $rel_model->key_field();
         $rel_display_field = $rel_module_obj->info('display_field');
         $module = strtolower(get_class($this));
         $module_obj = $CI->fuel->modules->get($module, FALSE);
         if (!$module_obj) {
             return array();
         }
         $model = $module_obj->model();
         $display_field = $module_obj->info('display_field');
         $rel_col = !empty($rel_module_obj->default_col) ? $rel_module_obj->default_col : $this->key_field();
         $rel_order = !empty($rel_module_obj->default_order) ? $rel_module_obj->default_order : 'asc';
         if ($prop == 'foreign_keys') {
             $groups = $rel_model->find_all_array(array(), $rel_model->key_field() . ' asc');
             $children = $this->find_all_array(array(), $key_field . ' asc');
             $g_key_field = $rel_model->key_field();
             $loc_field = $g_key_field;
         } else {
             if ($prop == 'has_many') {
                 $CI->load->module_model(FUEL_FOLDER, 'fuel_relationships_model');
                 $groups = $rel_model->find_all_array(array(), $rel_col . ' ' . $rel_order);
                 $children = $CI->fuel_relationships_model->find_by_candidate($this->table_name(), $rel_model->table_name(), NULL, 'array');
                 $key_field = 'foreign_id';
                 $g_key_field = 'candidate_id';
                 $display_field = 'candidate_' . $display_field;
                 $loc_field = $key_field;
             } else {
                 if ($prop == 'belongs_to') {
                     $CI->load->module_model(FUEL_FOLDER, 'fuel_relationships_model');
                     $groups = $rel_model->find_all_array(array(), $rel_col . ' ' . $rel_order);
                     $children = $CI->fuel_relationships_model->find_by_candidate($rel_model->table_name(), $this->table_name(), NULL, 'array');
                     $key_field = 'candidate_id';
                     $g_key_field = 'foreign_id';
                     $display_field = 'foreign_' . $display_field;
                     $loc_field = $key_field;
                 }
             }
         }
         // now get this models records
         foreach ($children as $child) {
             $used_groups[$child[$key_field]] = $child[$key_field];
             $attributes = (isset($child['published']) and $child['published'] == 'no' or isset($child['active']) and $child['active'] == 'no') ? array('class' => 'unpublished', 'title' => 'unpublished') : NULL;
             $return['g' . $child[$g_key_field] . '_c_' . $child[$key_field]] = array('parent_id' => $child[$key_field], 'label' => $child[$display_field], 'location' => fuel_url($module_obj->info('module_uri') . '/edit/' . $child[$loc_field]), 'attributes' => $attributes);
         }
         foreach ($groups as $group) {
             if (isset($used_groups[$group[$rel_key_field]])) {
                 $attributes = (isset($group['published']) and $group['published'] == 'no' or isset($group['active']) and $group['active'] == 'no') ? array('class' => 'unpublished', 'title' => 'unpublished') : NULL;
                 $return[$group[$rel_key_field]] = array('id' => $group[$rel_key_field], 'parent_id' => 0, 'label' => $group[$rel_display_field], 'location' => fuel_url($rel_module_obj->info('module_uri') . '/edit/' . $group[$rel_key_field]), 'attributes' => $attributes);
             }
         }
     }
     return $return;
 }
Example #18
0
		</ul>
	</div>
	

</div>

<div id="notification" class="notification">
	<?php 
echo $notifications;
?>
</div>
<div id="main_content">

	<div id="main_content_inner">

		<p class="instructions"><?php 
echo lang('profile_instructions');
?>
</p>

		<form method="post" action="<?php 
echo fuel_url('my_profile/edit/');
?>
" id="form">
		<?php 
echo $form;
?>
		</form>
	
	</div>
</div>
Example #19
0
?>
</h2>
</div>
<div class="clear"></div>

<div id="notification" class="notification">
	<?php 
echo $notifications;
?>
</div>
<div id="main_content" class="noaction">

	<div id="main_content_inner">
		
			<a href="<?php 
echo fuel_url('tools/validate');
?>
" id="back_to">&lt; Back to page selection</a>
			<div style="float: right;" class="btn">
				<form action="<?php 
echo site_url($this->uri->uri_string());
?>
" method="post" id="reload_form">
					<a href="javascript:$('#reload_form').submit()" class="ico ico_refresh">Reload All</a>
					<input type="hidden" name="pages_serialized" value="<?php 
echo $pages_serialized;
?>
" />
				</form>
			</div>
			<div id="validation_status"><h2 id="validation_status_text"></h2>
    echo lang('modal_yes_btn');
    ?>
</a></li>
				</ul>
			</div>
			<div class="clear"></div>
		</div>
	
	<?php 
}
?>

	<div id="main_content_inner">


		<p class="instructions"><?php 
echo $this->instructions;
?>
</p>

		<form method="post" action="<?php 
echo fuel_url($this->module_uri . '/' . $action . '/' . $id);
?>
" enctype="multipart/form-data" id="form">
		<?php 
echo $form;
?>
		</form>
	
	</div>
</div>
			<li><a href="<?php 
    echo fuel_url($this->module_uri . '/export');
    ?>
" class="ico ico_export" id="export_data"><?php 
    echo lang('btn_export_data');
    ?>
</a></li>
		<?php 
}
?>
		
		<?php 
if ($this->fuel->auth->module_has_action('create') and $this->fuel->auth->has_permission($this->permission, 'create')) {
    ?>
		<li class="end"><a href="<?php 
    echo fuel_url($create_url);
    ?>
" class="ico ico_create"><?php 
    echo $this->create_action_name;
    ?>
</a></li>
		<?php 
}
?>
	</ul>
	
	
</div>
<?php 
if (!empty($params['view_type'])) {
    echo $this->form->hidden('view_type', $params['view_type']);
Example #22
0
</span></em>  (not writable)</strong></p>
	<?php 
}
?>
	<?php 
echo $this->form->open(array('id' => 'form', 'method' => 'post'));
?>
	
	<div style="padding: 10px 0;"><?php 
echo $this->form->checkbox('include_assets', '1');
?>
 <label for="include_assets">Include the assets folder?</label></div>
	
	<div class="buttonbar">
		<ul>
			<li class="end"><a href="<?php 
echo fuel_url('recent');
?>
" class="ico ico_no">No, don't back it up</a></li>
			<li class="end"><a href="#" class="ico ico_yes" id="submit">Yes,  back it up</a></li>
		</ul>
	</div>
	<?php 
echo $this->form->hidden('action', 'backup');
?>
	<?php 
echo $this->form->close();
?>
	</div>

</div>
Example #23
0
 function _notify($comment, $post)
 {
     // send email to post author
     if (!empty($post->author)) {
         $this->load->library('email');
         $this->email->from($this->config->item('from_email', 'fuel'), $this->config->item('site_name', 'fuel'));
         $this->email->to($post->author->email);
         $this->email->subject(lang('blog_comment_monitor_subject', $this->fuel_blog->settings('title')));
         $msg = $this->lang->line('blog_comment_monitor_msg');
         $msg .= "\n" . fuel_url('blog/comments/edit/' . $comment->id) . "\n\n";
         $msg .= is_true_val($comment->is_spam) ? lang('blog_email_flagged_as_spam') . "\n" : '';
         $msg .= lang('blog_email_published') . ": " . $comment->published . "\n";
         $msg .= lang('blog_email_author_name') . ": " . $comment->author_name . "\n";
         $msg .= lang('blog_email_author_email') . ": " . $comment->author_email . "\n";
         $msg .= lang('blog_email_author_ip') . ": " . gethostbyaddr($comment->author_ip) . " (" . $comment->author_ip . ")\n";
         $msg .= lang('blog_email_content') . ": " . $comment->content . "\n";
         $this->email->message($msg);
         return $this->email->send();
     } else {
         return FALSE;
     }
 }
Example #24
0
?>
">Tools</a> &gt; Page Analysis</h2>
</div>
<div class="clear"></div>

<div id="notification" class="notification">
	<?php 
echo $notifications;
?>
</div>
<div id="main_content" class="noaction">

	<div id="main_content_inner">
		<p class="instructions">Select the page from the dropdown to analyze. Results will appear below which will display some key semantic results of your page.</p>
		<form action="<?php 
echo fuel_url('tools/seo');
?>
" method="post" id="form">
			<?php 
echo site_url();
echo $this->form->select('page', $pages_select, $this->input->post('page'));
?>
			<div style="text-align: center; margin-top: 10px;" class="buttonbar">
				<ul>
					<li class="end"><a href="#" class="ico ico_tools_seo" id="submit_page_analysis">Analyze</a></li>
				</ul>
			</div>
		</form>
		
		<div class="clear"></div>
Example #25
0
 function activity()
 {
     $this->_validate_user('manage/activity');
     $this->load->module_model(FUEL_FOLDER, 'logs_model');
     $this->load->library('pagination');
     $this->load->library('data_table');
     $this->load->helper('convert');
     $this->nav_selected = 'manage/activity';
     $page_state = $this->_get_page_state();
     /* PROCESS PARAMS BEGIN */
     $filters = array();
     $defaults = array();
     $defaults['col'] = 'entry_date';
     $defaults['order'] = 'asc';
     $defaults['offset'] = 0;
     $defaults['limit'] = 25;
     $defaults['search_term'] = '';
     $defaults['precedence'] = NULL;
     $uri_params = uri_safe_batch_decode(fuel_uri_segment(4), '|', TRUE);
     $uri_params = array();
     if (fuel_uri_segment(4)) {
         $uri_params['offset'] = (int) fuel_uri_segment(4);
     }
     $posted = array();
     if (!empty($_POST)) {
         if ($this->input->post('col')) {
             $posted['col'] = $this->input->post('col');
         }
         if ($this->input->post('order')) {
             $posted['order'] = $this->input->post('order');
         }
         if ($this->input->post('limit')) {
             $posted['limit'] = $this->input->post('limit');
         }
         if ($this->input->post('limit')) {
             $posted['offset'] = (int) $this->input->post('offset');
         }
         $posted['search_term'] = $this->input->post('search_term');
     }
     //$params = array_merge($defaults, $uri_params, $posted);
     $params = array_merge($defaults, $page_state, $uri_params, $posted);
     if ($params['search_term'] == lang('label_search')) {
         $params['search_term'] = NULL;
     }
     /* PROCESS PARAMS END */
     $seg_params = $params;
     unset($seg_params['offset']);
     $seg_params = uri_safe_batch_encode($seg_params, '|', TRUE);
     // if (!is_ajax() AND !empty($_POST))
     // {
     // 	$uri = fuel_url('manage/activity/offset/'.$params['offset']);
     // 	redirect($uri);
     // }
     $filters['first_name'] = $params['search_term'];
     $filters['last_name'] = $params['search_term'];
     $filters['message'] = $params['search_term'];
     $filters['entry_date'] = $params['search_term'];
     $this->logs_model->add_filters($filters);
     // pagination
     $config['base_url'] = fuel_url('manage/activity/offset/');
     $config['total_rows'] = $this->logs_model->list_items_total();
     $config['uri_segment'] = fuel_uri_index(4);
     $config['per_page'] = $params['limit'];
     $config['page_query_string'] = FALSE;
     $config['num_links'] = 5;
     $config['prev_link'] = lang('pagination_prev_page');
     $config['next_link'] = lang('pagination_next_page');
     $config['first_link'] = lang('pagination_first_link');
     $config['last_link'] = lang('pagination_last_link');
     $this->pagination->initialize($config);
     $this->_save_page_state($params);
     // data table
     $vars['params'] = $params;
     $vars['table'] = '';
     if (is_ajax()) {
         $items = $this->logs_model->list_items($params['limit'], $params['offset'], $params['col'], $params['order']);
         $this->data_table->row_alt_class = 'alt';
         $this->data_table->id = 'activity_data_table';
         // change this so that it doesn't have clickable rows'
         $this->data_table->only_data_cols = array('id');
         $this->data_table->set_sorting($params['col'], $params['order']);
         $this->data_table->auto_sort = TRUE;
         $this->data_table->sort_js_func = 'page.sortList';
         $headers = array('entry_date' => lang('form_label_entry_date'), 'name' => lang('form_label_name'), 'message' => lang('form_label_message'));
         $this->data_table->assign_data($items, $headers);
         $vars['table'] = $this->data_table->render();
         $this->load->view('_blocks/module_list_table', $vars);
         return;
     } else {
         $this->load->library('form_builder');
         $this->js_controller_params['method'] = 'activity';
         $vars['table'] = $this->load->view('_blocks/module_list_table', $vars, TRUE);
         $vars['pagination'] = $this->pagination->create_links();
         // for extra module filters
         $field_values = array();
         $this->_render('manage/activity', $vars);
     }
 }
Example #26
0
<div id="main_content" class="noaction">
	<div id="main_content_inner">

	<p class="instructions"><?php 
echo lang('cache_instructions');
?>
</p>
	<?php 
echo $this->form->open(array('id' => 'form', 'method' => 'post'));
?>
	
	<div class="buttonbar">
		<ul>
			<li class="end"><a href="<?php 
echo fuel_url('manage/');
?>
" class="ico ico_no"><?php 
echo lang('cache_no_clear');
?>
</a></li>
			<li class="end"><a href="#" class="ico ico_yes" id="submit"><?php 
echo lang('cache_yes_clear');
?>
</a></li>
		</ul>
	</div>
	
	<?php 
echo $this->form->hidden('action', 'cache');
?>
Example #27
0
 function upload()
 {
     $this->load->helper('file');
     $this->load->helper('security');
     $this->load->library('form_builder');
     $this->js_controller_params['method'] = 'upload';
     if (!empty($_POST)) {
         if (!empty($_FILES['file']['name'])) {
             $error = FALSE;
             $file_info = $_FILES['file'];
             // read in the file so we can filter it
             $file = read_file($file_info['tmp_name']);
             // sanitize the file before saving
             $id = $this->input->post('id', TRUE);
             $field = $this->js_controller_params['import_view_key'];
             $where['page_id'] = $id;
             $where['name'] = $field;
             $page_var = $this->pagevariables_model->find_one_array($where);
             if (empty($page_var)) {
                 add_error(lang('error_upload'));
             } else {
                 $file = $this->_sanitize($file);
                 $save['id'] = $page_var['id'];
                 $save['name'] = $this->js_controller_params['import_view_key'];
                 $save['page_id'] = $id;
                 $save['value'] = $file;
                 if (!$this->pagevariables_model->save($save)) {
                     add_error(lang('error_upload'));
                 }
             }
             if (!has_errors()) {
                 // change list view page state to show the selected group id
                 $this->session->set_flashdata('success', lang('pages_success_upload'));
                 redirect(fuel_url('pages/edit/' . $id));
             }
         } else {
             if (!empty($_FILES['file']['error'])) {
                 add_error(lang('error_upload'));
             }
         }
     }
     $fields = array();
     $pages = $this->model->options_list('id', 'location', array('published' => 'yes'), 'location');
     $fields['id'] = array('label' => lang('form_label_name'), 'type' => 'select', 'options' => $pages, 'class' => 'add_edit pages');
     $fields['file'] = array('type' => 'file', 'accept' => '');
     $this->form_builder->hidden = array();
     $this->form_builder->set_fields($fields);
     $this->form_builder->set_field_values($_POST);
     $this->form_builder->submit_value = '';
     $this->form_builder->use_form_tag = FALSE;
     $vars['instructions'] = lang('pages_upload_instructions');
     $vars['form'] = $this->form_builder->render();
     $this->_render('upload', $vars);
 }
|--------------------------------------------------------------------------
*/
$lang['error_no_access'] = 'You do not have access to this page. <a href="' . fuel_url() . '">Try logging in again</a>.';
$lang['error_missing_module'] = "You are missing the module %1s.";
$lang['error_invalid_login'] = '******';
$lang['error_max_attempts'] = 'Sorry, but your login information was incorrect and you are temporarily locked out. Please try again in %s seconds.';
$lang['error_empty_user_pwd'] = 'Please enter in a user name and password.';
$lang['error_pwd_reset'] = 'There was an error in resetting your password.';
$lang['error_invalid_email'] = 'The email address provided was not in the system.';
$lang['error_invalid_password_match'] = 'The passwords don\'t match.';
$lang['error_empty_email'] = 'Please enter in an email address.';
$lang['error_folder_not_writable'] = 'You must make the %1s folder writable.';
$lang['error_invalid_folder'] = 'Invalid folder %1s';
$lang['error_file_already_exists'] = 'File %1s already exists.';
$lang['error_zip'] = 'There was an error creating the zipped file.';
$lang['error_no_permissions'] = 'You do not have permissions to complete this action. <a href="' . fuel_url() . '">Try logging in again</a>.';
$lang['error_no_lib_permissions'] = 'You do not have permission to execute methods on the %1s class.';
$lang['error_page_layout_variable_conflict'] = 'There is an error with this layout because it either doesn\'t exist or contains one or more of the following reserved words: %1s';
$lang['error_no_curl_lib'] = 'You must have the curl php extension to use these tools.';
$lang['error_inline_page_edit'] = 'This variable must either be saved in the admin or edited in the associated views/_variables file.';
$lang['error_saving'] = 'There was an error saving.';
$lang['error_cannot_preview'] = 'There was an error in trying to preview this page.';
$lang['error_cannot_make_api_call'] = 'There was an error making the API call to %1s.';
$lang['error_sending_email'] = 'There was an error sending an email to %1s.';
$lang['error_upload'] = 'There was an error uploading your file. Please make sure the server is setup to upload files of this size and folders are writable.';
$lang['error_create_nav_group'] = 'Please create a Navigation Group';
$lang['error_requires_string_value'] = 'The name field should be a string value';
$lang['error_missing_params'] = 'You are missing parameters to view this page';
$lang['error_invalid_method'] = 'Invalid method name';
$lang['error_curl_page'] = 'Error loading page with CURL';
$lang['error_class_property_does_not_exist'] = 'Class property %1s does not exist';
Example #29
0
                        $section_hdr = ucfirst(str_replace('_', ' ', $section));
                    }
                    if ($section_hdr == 'Event') {
                        $section_hdr = '投票活動';
                    }
                    echo "<div class=\"left_nav_section\" id=\"leftnav_" . str_replace('/', '_', $section) . "\">\n";
                    echo "\t<h3>" . $section_hdr . "</h3>\n";
                    echo "\t<ul>\n";
                }
                echo "\t\t<li";
                if (preg_match('#^' . $nav_selected . '$#', $url)) {
                    echo ' class="active"';
                }
                // Use custom icons or default to key as class
                $icon = isset($icons[$key]) ? $icons[$key] : "ico_" . url_title(str_replace('/', '_', $key), '_', TRUE);
                echo "><a href=\"" . fuel_url($url) . "\" class=\"ico " . $icon . "\">" . $val . "</a></li>\n";
                $header_written = TRUE;
            }
        }
    } else {
        $header_written = FALSE;
    }
    if ($header_written) {
        echo "\t</ul>\n";
        echo "</div>\n";
    }
}
?>
				
			<?php 
$user_data = $this->fuel->auth->user_data();
Example #30
0
" title="<?php 
        echo lang('inline_edit_logout_title');
        ?>
"><?php 
        echo lang('inline_edit_logout');
        ?>
</a></li>
				<?php 
    } else {
        $uri = uri_string();
        if ($uri == '') {
            $uri = 'home';
        }
        ?>
				<li class="txt"><a href="<?php 
        echo fuel_url('login/' . uri_safe_encode($uri));
        ?>
" title="<?php 
        echo lang('inline_edit_login_title');
        ?>
"><?php 
        echo lang('inline_edit_login');
        ?>
</a></li>
				<?php 
    }
    ?>
				


			<?php