function url_for($route, $vars = 0)
{
    global $_routes;
    $og_route = $route;
    $route = url_explode($_routes[$route]['url']);
    foreach ($route as $key => $val) {
        # Check if the current route iteration is that of a wildcard.
        # We'll modify our $route array to include any passed values.
        # E.g. /this/:var will return this/passedVar
        if (is_route_wildcard($val)) {
            $r = str_replace(':', '', $val);
            if ($vars[$r]) {
                $route[$key] = $vars[$r];
            } else {
                die('missing var!');
            }
        }
    }
    # Return the URL.
    return '/' . implode('/', $route);
}
Ejemplo n.º 2
0
 function lists()
 {
     //$this->output->enable_profiler(false);
     if (in_array("q", $this->seg_exp)) {
         $arr_key = array_keys($this->seg_exp, "q");
         $arr_val = $arr_key[0] + 1;
         if (@$this->seg_exp[$arr_val]) {
             $search_word = $this->seg_exp[$arr_val];
         } else {
             $search_word = '검색어없음/';
         }
         $arr_key1 = array_keys($this->seg_exp, "sfl");
         if (@$arr_key1[0]) {
             $arr_val1 = $arr_key1[0] + 1;
         } else {
             $arr_val1 = 10;
         }
         if (@$this->seg_exp[$arr_val1]) {
             $sfl = $this->seg_exp[$arr_val1];
         } else {
             $sfl = 'subject';
         }
         $post = array('method' => $sfl, 's_word' => urldecode($search_word));
     } else {
         $post = '';
     }
     if ($this->session->userdata('auth_code') == 'ADMIN' or $this->session->userdata('auth_code') >= 0 or $this->list_perm == 1) {
         if (in_array("page", $this->seg_exp)) {
             $arr_key = array_keys($this->seg_exp, "page");
             $arr_val = $arr_key[0] + 1;
             if (@$this->seg_exp[$arr_val]) {
                 $data['page_account'] = $page = $this->seg_exp[$arr_val];
             } else {
                 $data['page_account'] = $page = 1;
             }
         } else {
             $data['page_account'] = $page = 1;
         }
         $data['division'] = $post['division'] = urldecode(url_explode($this->seg_exp, 'division'));
         $data['list_total'] = $total = $this->board_m->load_list_total($post, MENU_ID);
         $data['page_entry'] = $post['page_entry'] = url_explode($this->seg_exp, 'page_entry');
         if ($data['page_entry']) {
             $rp = $data['page_entry'];
         } else {
             $rp = 20;
         }
         $limit = 9;
         if (!is_numeric($page)) {
             $page = 1;
         }
         $start = ($page - 1) * $rp;
         //print_r($this->seg_exp);
         $this->url_seg = $this->seg_exp;
         $arr_s = array_search('page', $this->url_seg);
         if ($arr_s) {
             array_splice($this->url_seg, $arr_s, 2);
         }
         $urls = implode('/', $this->url_seg);
         $data['pagination_links'] = pagination($urls . "/page", paging($page, $rp, $total, $limit));
         $data['list'] = $this->board_m->load_list($start, $rp, $post, MENU_ID);
         $this->load->view('board/default/lists_v', $data);
     } else {
         if (!$this->session->userdata('userid')) {
             $rpath = str_replace("index.php/", "", $this->input->server('PHP_SELF'));
             $data['rpath_encode'] = strtr(base64_encode(addslashes(gzcompress(serialize($rpath), 9))), '+/=', '-_.');
             $this->load->view('login_view_v', $data);
         } else {
             $data['perm'] = "권한이 없습니다..";
             $this->load->view('perm_view_v', $data);
         }
     }
 }
Ejemplo n.º 3
0
<?php

require 'lib/system.config.php';
require 'lib/system.functions.php';
require 'lib/plugins.functions.php';
require 'user/config/routes.php';
require 'user/config/app.php';
require 'user/config/user.php';
# Define an array for controller's vars.
$_controller = array();
$_controller['current_url'] = curr_url();
$_url_match = 0;
# Check and see if we have a route match
foreach ($_routes as $_route) {
    $_controller['route_url'] = url_explode($_route['url']);
    # Check for an array size match between the current url and the current stored url iteration.
    if (count($_controller['current_url']) == count($_controller['route_url'])) {
        log_me("Looks like we've got a url count match on -- " . implode('/', $_controller['route_url']));
        $size = count($_controller['current_url']);
        # Compare the urls
        for ($i = 0; $i < $size; ++$i) {
            # Let's catch the route wildcards
            if (is_route_wildcard($_controller['route_url'][$i])) {
                # We know we're dealing with a wildcard--let's find out if it's a module or action
                if ($_controller['route_url'][$i] == ':module') {
                    $_module = str_replace(':', '', $_controller['current_url'][$i]);
                    log_me("The following module wildcard was found -- " . $_module);
                }
                if ($_controller['route_url'][$i] == ':action') {
                    $_action = str_replace(':', '', $_controller['current_url'][$i]);
                    log_me("The following action wildcard was found -- " . $_action);
Ejemplo n.º 4
0
 public function contact()
 {
     if (url_explode($this->seg_exp, 'page')) {
         $page = url_explode($this->seg_exp, 'page');
     } else {
         $page = 1;
     }
     $condition = array('page' => $page, 'scope' => $this->input->get('scope'), 'keyword' => $this->input->get('keyword'));
     $data['lists'] = $this->client_m->get_contact_lists($condition, $page, 20, '3');
     //vdd($data['lists']);
     $data['list_count'] = $this->client_m->get_contact_lists_count($condition, '3');
     $data['condition'] = $condition;
     $this->_getPaginationLinks($data, $this->seg_exp, $data['list_count'], $page);
     $this->load->view('/admin/client/contact_list_v', $data);
 }