本文整理汇总了PHP中fuel_uri函数的典型用法代码示例。如果您正苦于以下问题:PHP fuel_uri函数的具体用法?PHP fuel_uri怎么用?PHP fuel_uri使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了fuel_uri函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: upload
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);
}
示例2: dev_password
function dev_password()
{
$CI =& get_instance();
if ($CI->config->item('dev_password', 'fuel') and !$CI->fuel_auth->is_logged_in() and !preg_match('#^' . fuel_uri('login') . '#', uri_path(FALSE))) {
$CI->load->library('session');
if (!$CI->session->userdata('dev_password')) {
redirect('fuel/login/dev');
}
}
}
示例3: offline
public function offline()
{
if (!USE_FUEL_ROUTES) {
$CI =& get_instance();
if ($CI->fuel->config('offline') and !$CI->fuel->auth->is_logged_in() and !preg_match('#^' . fuel_uri('login') . '#', uri_path(FALSE))) {
echo $CI->fuel->pages->render('offline', array(), array(), TRUE);
exit;
}
}
}
示例4: index
function index()
{
$this->load->library('session');
$this->session->sess_destroy();
$this->load->module_library(FUEL_FOLDER, 'fuel_auth');
$this->load->helper('cookie');
$this->fuel_auth->logout();
$config = array('name' => $this->fuel_auth->get_fuel_trigger_cookie_name(), 'path' => WEB_PATH);
delete_cookie($config);
redirect(fuel_uri('login'));
}
示例5: edit
function edit()
{
$user = $this->fuel_auth->user_data();
$id = $user['id'];
if (!empty($_POST)) {
if ($id) {
if ($this->users_model->save()) {
$this->session->set_flashdata('success', lang('data_saved'));
redirect(fuel_uri('my_profile/edit/'));
}
}
}
$this->_form($id);
}
示例6: edit
public function edit()
{
$user = $this->fuel->auth->user_data();
$id = $user['id'];
if (!empty($_POST)) {
if ($id) {
if ($this->fuel_users_model->save()) {
$this->fuel->admin->set_notification(lang('data_saved'), Fuel_admin::NOTIFICATION_SUCCESS);
redirect(fuel_uri('my_profile/edit/'));
}
}
}
$this->_form($id);
}
示例7: edit
function edit()
{
$user = $this->fuel_auth->user_data();
$id = $user['id'];
if (!empty($_POST)) {
if (!empty($_POST['new_password']) && isset($_POST['confirm_password'])) {
$this->users_model->get_validation()->add_rule('password', 'is_equal_to', 'Your password confirmation needs to match', array($_POST['new_password'], $_POST['confirm_password']));
}
$this->users_model->add_validation('email', array(&$this->users_model, 'is_editable_email'), 'The email is empty or already exists', $id);
if ($id) {
if ($this->users_model->save()) {
$this->session->set_flashdata('success', $this->lang->line('data_saved'));
redirect(fuel_uri('my_profile/edit/'));
}
}
}
$this->_form($id);
}
示例8: edit
public function edit()
{
$user = $this->fuel->auth->user_data();
$id = $user['id'];
if (!empty($_POST)) {
if ($id) {
// make sure they are only
if ($id != $this->fuel->auth->user_data('id')) {
show_error(lang('error_no_permissions'));
}
$save = $this->input->post(NULL, TRUE);
$save['id'] = $id;
if ($this->fuel_users_model->save($save)) {
$this->fuel->admin->set_notification(lang('data_saved'), Fuel_admin::NOTIFICATION_SUCCESS);
redirect(fuel_uri('my_profile/edit/'));
}
}
}
$this->_form($id);
}
示例9: edit
function edit($id = NULL)
{
if (empty($id)) {
show_404();
}
$posted = $this->_process();
if ($this->input->post('id')) {
if (!$this->fuel_auth->has_permission($this->permission, 'publish')) {
unset($_POST['published']);
}
if ($this->model->save($posted)) {
$this->_process_uploads();
$this->_save_page_vars($id, $posted);
$data = $this->model->find_one_array(array($this->model->table_name() . '.id' => $id));
$msg = lang('module_edited', $this->module_name, $data[$this->display_field]);
$this->logs_model->logit($msg);
redirect(fuel_uri('pages/edit/' . $id));
}
}
$this->_form($id);
}
示例10: edit
public function edit($dir = NULL, $field = NULL, $redirect = TRUE)
{
redirect(fuel_uri('assets/create/' . $dir));
}
示例11: upload
public function upload()
{
$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/html', '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
$id = $this->input->post('id', TRUE);
$pagevars = $this->fuel->pages->import($id);
if (!empty($pagevars)) {
$layout = $this->fuel->layouts->get($pagevars['layout']);
unset($pagevars['layout']);
foreach ($pagevars as $key => $val) {
$where['page_id'] = $id;
$where['name'] = $key;
$page_var = $this->fuel_pagevariables_model->find_one_array($where);
$save['id'] = empty($page_var['id']) ? NULL : $page_var['id'];
$save['name'] = $key;
$save['page_id'] = $id;
$save['value'] = $val;
if (!$this->fuel_pagevariables_model->save($save)) {
add_error(lang('error_upload'));
}
}
// resave to prevent import popup on next page
$page = $this->fuel_pages_model->find_by_key($id, 'array');
$page['last_modified'] = date('Y-m-d H:i:s', time() + 1);
// to prevent window from popping up after upload
$this->model->save($page);
if (!has_errors()) {
// change list view page state to show the selected group id
$this->fuel->admin->set_notification(lang('pages_success_upload'), Fuel_admin::NOTIFICATION_SUCCESS);
redirect(fuel_url('pages/edit/' . $id));
}
} else {
add_error(lang('error_upload'));
}
} else {
$error_msg = $this->upload->display_errors('', '');
add_error($error_msg);
}
}
$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();
$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_FOLDER);
}
示例12: fuel_url
/**
* Creates the admin URL for FUEL (e.g. http://localhost/MY_PROJECT/fuel/admin)
*
* @access public
* @param string
* @param boolean
* @return string
*/
function fuel_url($uri = '', $query_string = FALSE)
{
$CI =& get_instance();
$uri = fuel_uri($uri, $query_string);
return site_url($uri);
}
示例13: _get_pages
function _get_pages()
{
$pages_input = $this->input->post('pages_input', TRUE);
$extra_pages = array();
if (!empty($pages_input) and $pages_input != lang('validate_pages_input')) {
$extra_pages = explode("\n", $pages_input);
foreach ($extra_pages as $key => $page) {
$extra_pages[$key] = site_url(trim($page));
}
}
$post_pages = !empty($_POST['pages']) ? $this->input->post('pages', TRUE) : array();
$pages = array_merge($post_pages, $extra_pages);
if (empty($pages)) {
$pages = $this->input->post('pages_serialized');
if (empty($pages)) {
redirect(fuel_uri('tools/validate'));
} else {
$pages = unserialize(base64_decode($pages));
}
}
return $pages;
}
示例14: restore
function restore()
{
if ($this->input->post('version') and $this->input->post('ref_id')) {
if (!$this->model->restore($this->input->post('ref_id'), $this->input->post('version'))) {
$msg = lang('module_restored', $this->module_name);
$this->logs_model->logit($msg);
$this->session->set_flashdata('error', $this->model->get_validation()->get_last_error());
} else {
$this->session->set_flashdata('success', $this->lang->line('module_restored_success'));
}
redirect(fuel_uri($this->module_uri . '/edit/' . $this->input->post('ref_id')));
} else {
show_404();
}
}
示例15: pwd_reset
public function pwd_reset()
{
if (!$this->fuel->config('allow_forgotten_password')) {
show_404();
}
$this->js_controller_params['method'] = 'add_edit';
if (!empty($_POST)) {
if ($this->input->post('email')) {
$user = $this->fuel_users_model->find_one_array(array('email' => $this->input->post('email')));
if (!empty($user['email'])) {
$users = $this->fuel->users;
$new_pwd = $this->fuel->users->reset_password($user['email']);
if ($new_pwd !== FALSE) {
$url = 'reset/' . md5($user['email']) . '/' . md5($new_pwd);
$msg = lang('pwd_reset_email', fuel_url($url));
$params['to'] = $this->input->post('email');
$params['subject'] = lang('pwd_reset_subject');
$params['message'] = $msg;
$params['use_dev_mode'] = FALSE;
if ($this->fuel->notification->send($params)) {
$this->session->set_flashdata('success', lang('pwd_reset'));
$this->fuel->logs->write(lang('auth_log_pass_reset_request', $user['email'], $this->input->ip_address()), 'debug');
} else {
$this->session->set_flashdata('error', lang('error_pwd_reset'));
$this->fuel->logs->write($this->fuel->notification->last_error(), 'debug');
}
redirect(fuel_uri('login'));
} else {
$this->fuel_users_model->add_error(lang('error_invalid_email'));
}
} else {
$this->fuel_users_model->add_error(lang('error_invalid_email'));
}
} else {
$this->fuel_users_model->add_error(lang('error_empty_email'));
}
}
$this->form_builder->set_validator($this->fuel_users_model->get_validation());
// build form
$fields['Reset Password'] = array('type' => 'section', 'label' => lang('login_reset_pwd'));
$fields['email'] = array('required' => TRUE, 'size' => 30, 'placeholder' => 'email', 'display_label' => FALSE);
$this->form_builder->show_required = FALSE;
$this->form_builder->set_fields($fields);
$vars['form'] = $this->form_builder->render();
// notifications template
$vars['error'] = $this->fuel_users_model->get_errors();
$vars['notifications'] = $this->load->view('_blocks/notifications', $vars, TRUE);
$vars['page_title'] = lang('fuel_page_title');
$this->load->view('pwd_reset', $vars);
}