Exemple #1
0
 public function __construct()
 {
     $this->CI =& get_instance();
     $this->CI->load->helper(array('file', 'url'));
     $this->CI->load->library('pagination');
     define('PARAM_DILEM', $this->CI->config->item('fire_log_param_dilem'));
     $this->url_vals = get_spark_params();
     $params = $this->url_vals;
     //		log_message( 'info', 'Hey there, You are running Fire Log Spark Version ' .$this->CI->config->item( 'fire_log_version') );
     //echo getcwd();
     //$this->CI->load->_ci_view_path = dirname(__DIR__).DIRECTORY_SEPARATOR.'views'.DIRECTORY_SEPARATOR;
     $this->today = 'log-' . date('Y-m-d') . '.php';
     if (isset($params['file']) and !empty($params['file'])) {
         $this->log_file = $params['file'];
         //	$this->build_heading(  );
         $this->view();
     } else {
         if (isset($params['delete'])) {
             $this->clear_file($params['delete']);
             log_message('info', $this->CI->lang->line('fire_log_file_deleted') . $params['delete']);
             $this->log_file = $this->today;
             redirect(current_url() . '/file' . PARAM_DILEM . $this->today);
         } else {
             redirect(current_url() . '/file' . PARAM_DILEM . $this->today);
         }
     }
 }
function param_is_valid($key, $allowed = array())
{
    $params = get_spark_params();
    $val = FALSE;
    if (isset($params[$key]) and !empty($params[$key])) {
        if (count($allowed) != 0 or in_array($params[$key], $allowed)) {
            $val = $params[$key];
        }
    }
    return $val;
}
function build_filter_link($filter, $label)
{
    $params = get_spark_params();
    $class = '';
    if (isset($params['filter']) and $filter == $params['filter']) {
        $class = 'active';
    } else {
        if (!isset($params['filter']) and $filter == 'all') {
            $class = 'active';
        }
    }
    $params['filter'] = $filter;
    $url = build_spark_url($params, TRUE);
    return "<a href=\"{$url}\" class=\"{$class}\">{$label}</a>";
}
Exemple #4
0
 public function __construct()
 {
     $this->CI =& get_instance();
     $this->CI->load->helper(array('file', 'url'));
     $this->CI->load->library('pagination');
     //HMVC compatible
     $this->CI->lang->load('fire_log', $this->CI->config->item('language'), FALSE, TRUE, APPPATH . '../sparks/fire_log/');
     $this->log_path = $this->CI->config->item('log_path');
     define('PARAM_DILEM', $this->CI->config->item('fire_log_param_dilem'));
     $this->url_vals = get_spark_params();
     $params = $this->url_vals;
     //		log_message( 'info', 'Hey there, You are running Fire Log Spark Version ' .$this->CI->config->item( 'fire_log_version') );
     //echo getcwd();
     //$this->CI->load->_ci_view_path = dirname(__DIR__).DIRECTORY_SEPARATOR.'views'.DIRECTORY_SEPARATOR;
     $this->today = 'log-' . date('Y-m-d') . '.php';
     if (isset($params['file']) and !empty($params['file'])) {
         $this->log_file = $params['file'];
         //	$this->build_heading(  );
         $this->view();
     } else {
         if (isset($params['delete'])) {
             $this->clear_file($params['delete']);
             log_message('info', $this->CI->lang->line('fire_log_file_deleted') . $params['delete']);
             $this->log_file = $this->today;
             redirect(current_url() . '/file' . PARAM_DILEM . $this->today);
         } else {
             if (isset($params['delete_all'])) {
                 $all = $this->list_files();
                 if (!empty($all)) {
                     foreach ($all as $f) {
                         if ($f['name'] === 'index.html') {
                             continue;
                         }
                         // Don't delete index.html
                         $this->clear_file($f['name']);
                     }
                     log_message('info', $this->CI->lang->line('fire_log_file_deleted') . $params['delete_all']);
                 }
                 $this->log_file = $this->today;
                 redirect(current_url() . '/file' . PARAM_DILEM . $this->today);
             } else {
                 redirect(current_url() . '/file' . PARAM_DILEM . $this->today);
             }
         }
     }
 }