<?php

function set_upload_offers($path){
	
	$config = array();
	$config['upload_path'] = $path;
	$config['allowed_types'] = 'gif|jpg|png';
	$config['overwrite']     = FALSE;
	return $config;
	
}

function set_upload_profilepic($path){
	
	$config = array();
	$config['upload_path'] = $path;
	$config['allowed_types'] = 'gif|jpg|png';
	$config['overwrite']     = FALSE;
	return $config;
	
}

function set_upload_service($path){
    
    $config = array();
    $config['upload_path'] = $path;
    $config['allowed_types'] = 'gif|jpg|png';
    $config['overwrite'] = FALSE;
    return $config;
    
}

function set_upload_editservice($path){
    
    $config = array();
    $config['upload_path'] = $path;
    $config['allowed_types'] = 'gif|jpg|png';
    $config['overwrite'] = FALSE;
    return $config;
    
}

function remove_html(&$item, $key)
{
    $item = strip_tags($item);
}

function set_log($class,$method,$postdata,$auth){

	$CI = & get_instance();

	$url = $class.'/'.$method;

	$data = array('url'=>$url,

				  'parameter'=>$postdata,

				  'auth'=>$auth,

				  'time'=>date('Y-m-d h:i:s'));
	

	$CI->db->insert('service_log',$data);
		//echo $CI->db->last_query();
	return $CI->db->insert_id();
}

function pr($val){
	if(is_array($val)){
		echo '<pre>';
	}
	print_r($val);exit;
}

function pre($val){
	if(is_array($val)){
		echo '<pre>';
	}
	print_r($val);
}

function encode_param($param = ''){
	if(empty($param)){
		return;
	}
	return urlencode(base64_encode('{***}'.$param.'{***}'));
}

function decode_param($param = ''){
	if(empty($param)){
		return;
	}
	return trim(base64_decode(urldecode($param)),'{***}');
}
?>