当前位置 : 主页 > 网络编程 > PHP >

DESTOON 火车头采集发布接口

来源:互联网 收集:自由互联 发布时间:2021-06-28
DESTOON 火车头采集发布接口 get_all("select catid as fid,catname as name,parentid as fup from #@_category where moduleid='".$get['moduleid']."'");echo ' ';$nanmu = fenlei($row);echo $nanmu;echo ' ';exit();}else{if(!$post['moduleid']
DESTOON 火车头采集发布接口
 get_all("select catid as fid,catname as name,parentid as fup from #@_category where moduleid='".$get['moduleid']."'");
		echo '';
		exit();
	}else{
		if(!$post['moduleid']) exit('moduleid is null'.$lang['post_faild']);
		if(!$post['title']) exit('title is null'.$lang['post_faild']);		
		if($dft[$post['moduleid']]) $post = array_merge($dft[$post['moduleid']],$post);
		if(!$post['catid']){
			$cat_arr = get_cate($post);
			if(!$cat_arr['catid']) exit($lang['catid_null'].$lang['post_faild']);
			$post = array_merge($post,$cat_arr);
		}
		$table= get_table($post['moduleid']);
		$table_data = get_table($post['moduleid'],1);
		if($MOD['introduce_length']){
			$post['intro']=mb_substr( strip_tags ($post['content'] ), 0, $MOD['introduce_length'],$DT['pcharset'] );
			$post['introduce']=mb_substr( strip_tags ($post['content'] ), 0, $MOD['introduce_length'],$DT['pcharset'] );
		}
		if($post['areaname']){
			$area = get_area_from_name($post['areaname']);
			$post = array_merge($post,$area);
		}
		if($moduleid=='22' || $moduleid=='5' || $moduleid=='16'){
			if($post['nv1']) list($post['n1'],$post['v1']) = explode("#",$post['nv1']);
			if($post['nv2']) list($post['n2'],$post['v2']) = explode("#",$post['nv2']);
			if($post['nv3']) list($post['n3'],$post['v3']) = explode("#",$post['nv3']);
		}
		if($moduleid=='9'){
			if($post['salary']) list($post['minsalary'],$post['maxsalary']) = explode("|",$post['salary']);
			if($post['age']) list($post['minage'],$post['maxage']) = explode("|",$post['age']);
			foreach($job_arr as $k=>$arr){
				if($post[$k]){
					$post[$k] = array_search($post[$k],$arr);
				}
			}
		}
		if($moduleid=='16'){
			$express = $ldb->get_one("select * from #@_mall_express where username='".$post['username']."'");
			if($express){
				$post['express_1']=$express['itemid'];
				$post['express_name_1']=$express['express'];
				$post['fee_start_1']=$express['fee_start'];
				$post['fee_step_1']=$express['fee_step'];
			}
			for($i=1;$i<=3;$i++){
				$post['v'.$i] = str_trim($post['v'.$i],"|");
				if(!strstr($post['v'.$i],"|")) {
					unset($post['n'.$i]);
					unset($post['v'.$i]);
				}
			}
		}		
		$CATEGORY = cache_read('category-'.$moduleid.'.php');
		$m_data = get_mdata($post);
		if(!$m_data) exit('username is void'.$lang['post_faild']);
		foreach($m_data as $k=>$v){
			if(strstr($k,"time")) unset($m_data[$k]);
		}
		$post = array_merge($m_data,$post);
		$ldb->query("lock table ".$table." write");
		if($locoy_cfg['title_check']){			
			if($ldb->check_exist("select * from ".$table." where title='".real_escape($post['title'])."'")){
				$ldb->query("unlock tables ");
				exit( $lang['title_exists']. $lang['post_succeed']);
			}
		}
		$ldb->query("unlock tables ");
		$module = $ldb->get_one_value("select module from #@_module where moduleid='".$moduleid."'");
		require_once('module/'.$module."/".$module.".class.php");
		require DT_ROOT.'/module/'.$module.'/common.inc.php';
		$do = new $module($moduleid);		
		$img_array= preg_img($post['pics']);
		if(!$img_array && $locoy_cfg['thumb_from_content']) $img_array = preg_img($post['content']);
		$no = (in_array('thumb1',$do->fields)) ? 3:1;
		$img_array = get_arrvalue($img_array,$no);
		$nimg_array=array();
		foreach($img_array as $iurl){
			if(!$iurl){
				$nimg_array[] = $iurl;
				continue;
			}
			$nimg_array[] = download_simg($iurl);
		}
		@list ( $post ['thumb'], $post ['thumb1'], $post ['thumb2']) = $nimg_array;
		if($MOD['save_remotepic'] || $post['save_remotepic']) $post['content'] = replace_img($post['content']);
		$fields = $ldb->get_all("select name,html,default_value,option_value from #@_fields where tb='".str_replace($DT_PRE,"",$table)."'");
		if($fields){
			foreach($fields as $field){
				if(!$post[$field['name']]) {
					$post[$field['name']] = $field['default_value'];
					continue;
				}
				$opv = '';				
				switch($field['html']){
					case 'select':
					case 'radio':
					$op_arr = explode("*",$field['option_value']);
					foreach($op_arr as $op){
						if($opv) continue;
						list($k,$v) = explode("|",$op);
						if(!$v||!$k) continue;
						if(strstr($post[$field['name']],trim($v))) $opv =trim($k);
					}
					$post[$field['name']] = $opv ? $opv:$field['default_value'];
					break;
					case 'checkbox':
					$op_arr = explode("*",trim($field['option_value']));
					$pv = explode("|||",$post[$field['name']]);
					$pv = array_unique($pv);
					foreach($op_arr as $op){
						list($k,$v) = explode("|",$op);
						if(!$v||!$k) continue;
						foreach($pv as $pvv){
							if(strstr($pvv,trim($v))) $opv .=",".trim($k);
						}
					}
					$post[$field['name']] = $opv ? trim($opv,","):$field['default_value'];
				}
			}
		}
		$itemid = $post['itemid'] = $ldb->insert_array($table,$post);
		if($ldb->insert_array($table_data,$post)){
			$do->update($post['itemid']);
			if($MOD['show_html'] && $post['status'] > 2) $do->tohtml($post['itemid']);
		}else{
			$ldb->query("delete from ".$table." where itemid='".$post['itemid']."'");
			exit($lang['post_faild'].$ldb->halt);
		}
		exit( $lang['post_succeed']);		
	}
	break;
	default:
	exit($lang['no_module']);
}
网友评论