function getParamFromURL($param = false) { $url = getCurentURL(); $site = site_url(); $url = str_ireplace($site, '', $url); $segs = explode('/', $url); foreach ($segs as $segment) { $segment = explode(':', $segment); if ($segment[0] == $param) { return $segment[1]; } } return false; }
function url_param_unset($param, $url = false) { if ($url == false) { $url = getCurentURL(); } $site = site_url(); $url = str_ireplace($site, '', $url); $segs = explode('/', $url); $segs_clean = array(); foreach ($segs as $segment) { $origsegment = $segment; $segment = explode(':', $segment); if ($segment[0] == $param) { //return $segment [1]; } else { $segs_clean[] = $origsegment; } } $segs_clean = implode('/', $segs_clean); $site = site_url($segs_clean); return $site; }
$subdomain_user = $subdomain_user[0]; setcookie("microweber_referrer_user_id", $subdomain_user['id'], time() + 60 * 60 * 24 * 90, '/'); // 90 days setcookie("referrer_id", $subdomain_user['id'], time() + 60 * 60 * 24 * 90, '/'); // 90 days $subdomain_user_test = CI::library('session')->userdata('subdomain_user'); $subdomain_user_test = serialize($subdomain_user_test); $subdomain_user_test = md5($subdomain_user_test); $subdomain_user_test2 = serialize($subdomain_user); $subdomain_user_test2 = md5($subdomain_user_test2); if ($subdomain_user_test != $subdomain_user_test2) { CI::library('session')->set_userdata('subdomain_user', $subdomain_user); } //set the cannonical URL for duplicated content // http://googlewebmastercentral.blogspot.com/2009/02/specify-your-canonical.html $url = getCurentURL(); $url = str_ireplace($subdomain_user['username'] . '.', '', $url); $this->template['meta_cannonical_url'] = $url; } else { $subdomain_user_test = CI::library('session')->userdata('subdomain_user'); $subdomain_user_test = serialize($subdomain_user_test); $subdomain_user_test = md5($subdomain_user_test); $subdomain_user_test2 = serialize(false); $subdomain_user_test2 = md5($subdomain_user_test2); if ($subdomain_user_test != $subdomain_user_test2) { CI::library('session')->set_userdata('subdomain_user', false); } $this->template['meta_cannonical_url'] = false; } //p($subdomain_user); //$this->template ['created_by'] = false;
function urlConstruct($base_url = false, $params = array()) { //getCurentURL() if ($base_url == false) { $base_url = getCurentURL(); } // print $base_url; if (empty($params)) { return $base_url; } $the_url = parse_url($base_url, PHP_URL_QUERY); $the_url = $base_url; $the_url = explode('/', $the_url); //var_dump ( $the_url ); if ($params['curent_page'] == false) { $params['curent_page'] = 'inherit'; } $new = array(); $passed_keys = array(); foreach ($params as $param_key => $param_value) { if (in_array($param_key, $passed_keys) == false) { $chunk = array(); $chunk[0] = $param_key; if ($param_value == 'inherit') { $param_value = $this->getParamFromURL($param_key); if ($param_value != false) { $chunk[1] = $param_value; } else { $chunk = array(); } } else { $chunk[1] = $param_value; } if ($param_value != 'remove') { if (!empty($chunk)) { $new[] = implode(':', $chunk); } } $passed_keys[] = $param_key; } } $new = implode('/', $new); $new_url = $base_url . '/' . $new; $new_url = reduce_double_slashes($new_url); return $new_url; }
<li> <a href="<?php print site_url('users/user_action:post'); ?> ">Add post</a> </li>--> <li><a title="Preview your profile" class="title-tip<?php if (getCurentURL() == site_url('users/user_action:profile')) { ?> active<?php } ?> " href="<?php print site_url('userbase/action:profile/username:'******'username']; ?> ">Profile</a></li> <li><a title="Publish new content" class="Publish title-tip<?php if (getCurentURL() == site_url('users/user_action:post')) { ?> active<?php } ?> " href="<?php print site_url('users/user_action:post'); ?> ">Publish</a></li> <li><a title="Search" class="title-tip" href="javascript:quickSearchBox();">Search</a></li> </ul> </div> </div> <?php //var_dump($shipping_service = $this->session->userdata ( 'user' )) ; } else {
function getMenuItemsByMenuName($name) { $args = func_get_args(); foreach ($args as $k => $v) { $function_cache_id = $function_cache_id . serialize($k) . serialize($v); } $function_cache_id = __FUNCTION__ . md5($function_cache_id); $cache_content = CI::model('core')->cacheGetContentAndDecode($function_cache_id); if ($cache_content != false) { return $cache_content; } $data = false; $data['item_title'] = $name; $data['item_type'] = 'menu'; $orderby = array(); $orderby[0] = 'position'; $orderby[1] = 'asc'; $data = $this->getMenus($data, $orderby); $the_menu = $data[0]; $the_menu = $this->getMenuItems($the_menu['id']); $the_curent_url = $this->uri->uri_string(); //is slash $slash = substr("{$the_curent_url}", 0, 1); if ($slash == '/') { $the_curent_url = substr("{$the_curent_url}", 1, strlen($the_curent_url)); } //print $the_curent_url; //print ACTIVE_CONTENT_ID; $menu_data = array(); foreach ($the_menu as $item) { $data = array(); $data_to_append = array(); $data['id'] = $item['content_id']; // $content_item = $this->getContent($data, $orderby = false, $limit = false, $count_only = false, $short_data = true); $content_item = $content_item[0]; $url = false; if (!empty($content_item)) { $data_to_append['title'] = $content_item['content_title']; } else { $data_to_append['title'] = $item['item_title']; } $url = site_url($content_item['content_url']); if ($content_item['is_home'] == 'y') { $url = site_url(); } if (intval($item['content_id']) == 0) { $url = $item['menu_url']; } $data_to_append['url'] = $url; $is_active = false; //print $url; //print site_url ( $the_curent_url ); //print "<hr>"; if ($url == site_url($the_curent_url)) { // $is_active = true; } if ($content_item['is_home'] == 'y') { // if($the_curent_url = ''){ // $is_active = true; // } } if (intval($GLOBALS['ACTIVE_PAGE_ID']) == intval($content_item['id'])) { $is_active = true; } if (intval($item['content_id']) == 0) { $check = getCurentURL(); if ($check == $item['menu_url']) { $is_active = true; } } $data_to_append['is_active'] = $is_active; $menu_data[] = $data_to_append; } //$ //var_dump ( $menu_data ); CI::model('core')->cacheWriteAndEncode($menu_data, $function_cache_id); return $menu_data; }
<?php if ($this->core_model->optionsGetByKey('require_login_to_comment') == 'y') { if (strval($user_session['is_logged']) != 'yes') { ?> <form method="post" class="validate" action="<?php print site_url('users/user_action:login'); ?> /back_to:<?php print base64_encode(getCurentURL()); ?> " id="logIn"> <h2 style="padding-bottom: 12px;" class="title">Sign in to comment</h2> <div class="login-item" style="margin-right: 90px;"> <label>Username or Email: <strong>*</strong></label> <span class="linput"> <input name="username" class="required" type="text" /> <a class="reg-help" href="<?php print site_url('users/user_action:forgotten_pass'); ?> ">Lost your password?</a> </span> </div> <div class="login-item"> <label>Password: <strong>*</strong></label> <span class="linput"> <input name="password" class="required" type="password" /> <a class="reg-help" href="<?php print site_url('users/user_action:forgotten_pass'); ?>
</script> <div class="main" style="height: 400px;"> <div class="border-bottom" id="top-inner-title" style="margin-bottom: 12px;"> <h2>Login</h2> </div> <form action="<?php print getCurentURL(); ?> " method="post" id="logIn" class="validate" onsubmit="rememberMe();"> <?php if (!empty($user_login_errors)) { ?> <ol class="submit-error-info"> <?php foreach ($user_login_errors as $k => $v) { ?> <li><?php print $v; ?> </li> <?php