Exemplo n.º 1
1
Arquivo: blog.php Projeto: Rotron/hero
 function view($url_path)
 {
     // we may have a URL with "/" in it, so let's combine all the arguments into a URL string
     $args = func_get_args();
     $url_path = implode('/', $args);
     // end URL from arguments code
     $this->load->model('blogs/blog_model');
     $blog_id = $this->blog_model->get_blog_id($url_path);
     $blog = $this->blog_model->get_blog($blog_id);
     if (empty($blog_id) or empty($blog)) {
         return show_404($url_path);
     }
     // get blog
     $content = $this->blog_model->get_blog_content($blog_id, $this->input->get('page'));
     // do they have permissions?
     if (!$this->user_model->in_group($blog['privileges'])) {
         $this->load->helper('paywall/paywall');
         if (paywall($blog, 'content') !== FALSE) {
             die;
         }
     }
     // get pagination
     $pagination = $this->blog_model->get_blog_pagination($blog_id, site_url($blog['url_path']) . '?', $this->input->get('page'));
     // show content
     $this->smarty->assign('content', $content);
     $this->smarty->assign('pagination', $pagination);
     $this->smarty->assign($blog);
     return $this->smarty->display($blog['template']);
 }
Exemplo n.º 2
0
 function view($url_path)
 {
     // we may have a URL with "/" in it, so let's combine all the arguments into a URL string
     $args = func_get_args();
     $url_path = implode('/', $args);
     // end URL from arguments code
     // load gallery
     $this->load->model('publish/content_model');
     $content_id = $this->content_model->get_content_id($url_path);
     if (empty($content_id)) {
         return show_404($url_path);
     }
     $content = $this->content_model->get_content($content_id);
     // does this content exist?
     if (empty($content)) {
         return show_404($url_path);
     }
     // load images into gallery
     $this->load->model('gallery/gallery_image_model');
     $content['images'] = $this->gallery_image_model->get_images($content['id']);
     // do they have permissions to see content?
     if (!$this->user_model->in_group($content['privileges'])) {
         $this->load->helper('paywall/paywall');
         if (paywall($content, 'content') !== FALSE) {
             die;
         }
     }
     // are we downloading as a zip?
     if ($this->input->get('download') == 'zip') {
         return $this->download_zip($content);
     }
     // show content
     $this->smarty->assign($content);
     return $this->smarty->display('gallery.thtml');
 }
Exemplo n.º 3
0
 function view($url_path)
 {
     // we may have a URL with "/" in it, so let's combine all the arguments into a URL string
     $args = func_get_args();
     $url_path = implode('/', $args);
     // end URL from arguments code
     $this->load->model('publish/content_model');
     $content_id = $this->content_model->get_content_id($url_path);
     if (empty($content_id)) {
         return show_404($url_path);
     }
     // administrators used to not have to wait to see content, but that's not good enough anymore
     // because (a) it's confusing and (b) they are not auto-logged-in to the frontend even though
     // they are logged into the control panel
     //
     // so now we have the ?preview=[key] appendage to the URL which activates "preview mode"
     $preview_mode = FALSE;
     if ($this->input->get('preview')) {
         $this->load->library('encrypt');
         $preview_key = $this->encrypt->decode(base64_decode($this->input->get('preview')));
         if ($preview_key == $url_path) {
             $preview_mode = TRUE;
         }
     }
     $allow_future = $preview_mode == TRUE ? TRUE : FALSE;
     $content = $this->content_model->get_content($content_id, $allow_future);
     // does this content exist?
     if (empty($content)) {
         if ($this->input->get('preview')) {
             return show_error('Your preview key cannot be validated, and so we are showing the standard 404 page.');
         } else {
             return show_404($url_path);
         }
     }
     // do they have permissions to see content?
     if (!$this->user_model->in_group($content['privileges'])) {
         $this->load->helper('paywall/paywall');
         if (paywall($content, 'content') !== FALSE) {
             die;
         }
     }
     // trigger show_content hook
     // prep the hook with data
     $this->app_hooks->data_var('content_id', $content_id);
     // trigger with 1 additional arguments
     $this->app_hooks->trigger('view_content', $content_id);
     // be kind, reset the hook's data so that the next hook trigger doesn't accidentally pass email data that doesn't exist
     $this->app_hooks->reset();
     // show content
     $this->smarty->assign($content);
     // should we format this is as XML?
     if (strpos($url_path, '.xml') !== FALSE) {
         header("Content-Type: text/xml");
     }
     return $this->smarty->display($content['template']);
 }
Exemplo n.º 4
0
Arquivo: form.php Projeto: Rotron/hero
 function view($url_path)
 {
     // we may have a URL with "/" in it, so let's combine all the arguments into a URL string
     $args = func_get_args();
     $url_path = implode('/', $args);
     // end URL from arguments code
     $this->load->model('forms/form_model');
     $form_id = $this->form_model->get_form_id($url_path);
     if (empty($form_id)) {
         return show_404($url_path);
     }
     // get the form
     $form = $this->form_model->get_form($form_id);
     if (empty($form)) {
         die(show_404($url_path));
     }
     // do they have permissions?
     if (!$this->user_model->in_group($form['privileges'])) {
         $this->load->helper('paywall/paywall');
         if (paywall($form, 'form') !== FALSE) {
             die;
         }
     }
     // do we have passed values?
     $values = $this->input->get('values') ? unserialize(query_value_decode($this->input->get('values'))) : array();
     // we don't want non values, so we'll fill the $values array with empty placeholders
     if (empty($values)) {
         $this->load->model('custom_fields_model');
         $fields = $this->custom_fields_model->get_custom_fields(array('group' => $form['custom_field_group_id']));
         foreach ($fields as $field) {
             $values[$field['name']] = null;
         }
     }
     // errors
     $errors = $this->input->get('errors') == 'true' ? $this->session->flashdata('validation_errors') : FALSE;
     // show content
     $this->smarty->assign($form);
     $this->smarty->assign('validation_errors', $errors);
     $this->smarty->assign('values', $values);
     return $this->smarty->display($form['template']);
 }