本文整理汇总了PHP中fuel_url函数的典型用法代码示例。如果您正苦于以下问题:PHP fuel_url函数的具体用法?PHP fuel_url怎么用?PHP fuel_url使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了fuel_url函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _remap
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'));
}
示例2: tree
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;
}
示例3: tree
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;
}
示例4: 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);
}
示例5: tree
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;
}
示例6: _remap
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);
}
示例7: reset_page_state
/**
* 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));
}
}
示例8: tree
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;
}
示例9: tree
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;
}
示例10: _remap
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'));
}
示例11: tree
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;
}
示例12: tree
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;
}
示例13: tree
/**
* 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;
}
示例14: upload
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);
}
示例15: fuel_url
/**
* 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);
}