GetServerUrl(); $scriptPath = NULL; if ( isset($_SERVER['SCRIPT_NAME']) ) { $scriptPath = $_SERVER['SCRIPT_NAME']; $scriptPath = ( $scriptPath == '/' ) ? '' : dirname($scriptPath); } $base = basename(dirname($_SERVER['SCRIPT_NAME'])); $sus_dirs = array('admin_area','includes','plugins','files','actions','cb_install'); $remove_arr = array(); $remove_arr[] = '/:\/\/www\./'; if($more) $remove_arr[] = $more; if(in_array($base,$sus_dirs)) $remove_arr[] = '/\/'.$base.'/'; //Clearing Plugin and Player baseurl if(strstr($scriptPath,'/plugins/')) $scriptPath = preg_replace('/(.*)\/plugins(.*)/i',"$1",$scriptPath); if(strstr($scriptPath,'/player/')) $scriptPath = preg_replace('/(.*)\/plugins(.*)/i',"$1",$scriptPath); $baseURL = $serverURL . $scriptPath; $baseURL = preg_replace($remove_arr,'',$baseURL); if(substr($baseURL,strlen($baseURL)-1,1)=='/') $baseURL = substr($baseURL,0,strlen($baseURL)-1); return $baseURL; } function GetCurrentUrl() { global $in_bg_cron; if(!$in_bg_cron) { $serverURL = $this->GetServerUrl(); $requestURL = $_SERVER['REQUEST_URI']; return $serverURL . $requestURL; } } //This Function Set The PageDirect function page_redir(){ setcookie("pageredir",clean($this->GetCurrentUrl()),time()+7200,'/'); Assign('pageredir',@$_COOKIE['pageredir']); } //This Funtion is use to Show Admin Panels Pages function show_admin_page($page){ $pages = array( 'main' => 'main.php', 'server_check' => 'verifier.php', 'members_showall' => 'members.php?view=showall', 'members_inactive' => 'members.php?view=inactive', 'members_active' => 'members.php?view=active', 'members_addmember' => 'members.php?view=addmember', 'members_search' => 'members.php?view=search' ); return @$pages[$page]; } //Redirects page to without www. function redirectOrig() { $curpage = $this->GetCurrentUrl(); $newPage = preg_replace('/:\/\/www\./','://',$curpage); if($curpage !=$newPage) header("location:$newPage"); } function create_url($params_array,$url=NULL,$remove_param=false,$urlencode=false) { if($url==NULL or $url == 'auto') { if($_SERVER['QUERY_STRING']) $url = '?'.$_SERVER['QUERY_STRING']; } $new_link = ''; $new_link .= $url; if(is_array($params_array)) { foreach($params_array as $name => $value) { if($url) $new_link .='&'.$name.'='.$value; else $new_link .='?'.$name.'='.$value; } } return $new_link; } //This Fucntion is used to Redirect to respective URL function redirect($url){ echo ''; } /** * Function used to create link */ function create_link($page,$link=NULL,$extra_params=NULL,$tag=' #page# ',$return_param=false) { if($link==NULL or $link == 'auto') { if($_SERVER['QUERY_STRING']) $link = '?'.$_SERVER['QUERY_STRING']; } $page_pattern = '#page#'; $param_pattern = '#params#'; $page_url_param = $this->url_page_var; $page_link_pattern = $page_url_param.'='.$page_pattern; $link = preg_replace(array('/(\?page=[0-9]+)/','/(&page=[0-9]+)/','/(page=[0-9+])+/'),'',$link); preg_match('/\?/',$link,$matches); $no_seo = false; if(!empty($matches[0])) { $no_seo = true; $page_link = '&'.$page_link_pattern; }else{ $page_link = '?'.$page_link_pattern; } //Now checking if url is using & and ? then do not apply PAGE using slash instead use & or ? $current_url = $_SERVER['REQUEST_URI']; preg_match('/\?/',$current_url,$cur_matches); if(count($cur_matches)) $has_q = true; preg_match('/\.php/',$current_url,$cur_matches); if(count($cur_matches)) $has_php = true; preg_match('/&/',$current_url,$cur_matches); if(count($cur_matches)) $has_amp = true; $link = $link.$page_link; $params = 'href="'.$link.'"'; $params .= ' '.$extra_params; if($has_php && ($has_amp || $has_q)) $use_seo = false; else $use_seo = true; if(SEO=='yes' && THIS_PAGE !='search_result' && !BACK_END && $use_seo) { if(count($_GET)==0 || (count($_GET)==3 && isset($_GET['page']))) $params = $params; else $params ='href="./'.$page.'"'; } $final_link = preg_replace(array("/$page_pattern/i","/$param_pattern/i"),array($page,$params),$tag); $final_link = preg_replace(array("/$page_pattern/i","/$param_pattern/i"),array($page,$params),$final_link); if($return_param) { return preg_replace("/$page_pattern/i",$page,$params); } return ' '.$final_link.' '; } /** * Function used to create pagination * @param : total number of pags * @param : current page * @param : extra paraments in the tag ie #page#') { if($total==0) return false; if($page<=0||$page==''||!is_numeric($page)) $page = 1; $total_pages = $total; $pagination_start = 14; $display_page = 7; $this->selected = $selected = $page; $hellip = '…'; $first_hellip = ''; $second_hellip = ''; $start = ''; $mid = ''; $end = ''; $start_last = ''; $end_first = ''; $mid_first = ''; $mid_last = ''; $differ = round(($display_page/2)+.49,0)-1; if($pagination_start < $total_pages) { //Starting First for($i=1;$i<=$display_page;$i++) { if($selected == $i) { $start .= '