function ReturnAddF($add, $modid, $userid, $username, $do = 0, $rdata = 0, $ch = 0) { global $empire, $public_r, $dbtbpre, $emod_r; if ($do == 0 || $do == 1) { //导入gd处理文件 if ($add['mark'] || $add['getfirsttitlespic'] || $add['mcreatespic']) { include_once ECMS_PATH . 'e/class/gd.php'; } } $ret_r['tb'] = $emod_r[$modid]['deftb']; $r = explode(',', $emod_r[$modid][enter]); $count = count($r) - 1; if (empty($do)) { //数据库操作 for ($i = 1; $i < $count; $i++) { $f = $r[$i]; if ($f == 'special.field' || !strstr($emod_r[$modid]['canaddf'], ',' . $f . ',')) { continue; } $add[$f] = ReturnCheckboxAddF($add[$f], $modid, $f); //复选框 $value = RepPhpAspJspcodeText($add[$f]); if ($f == 'newstime') { $value = empty($value) ? time() : to_time($value); } elseif ($f == "morepic") { $value = ReturnMorepicpath($add['msmallpic'], $add['mbigpic'], $add['mpicname'], $add['mdelpicid'], $add['mpicid'], $add, $add['mpicurl_qz'], 0); } elseif ($f == "downpath") { $value = ReturnDownpath($add['downname'], $add['downpath'], $add['delpathid'], $add['pathid'], $add['downuser'], $add['fen'], $add['thedownqz'], $add, $add['foruser'], $add['downurl_qz'], 0); } elseif ($f == "onlinepath") { $value = ReturnDownpath($add['odownname'], $add['odownpath'], $add['odelpathid'], $add['opathid'], $add['odownuser'], $add['ofen'], $add['othedownqz'], $add, $add['oforuser'], $add['onlineurl_qz'], 0); } elseif ($f == "smalltext") { if (!trim($value)) { $value = SubSmalltextVal($add[newstext], $public_r[smalltextlen]); //截取新闻内容 } } elseif ($f == 'infoip') { $value = egetip(); } elseif ($f == 'infozm') { $value = $value ? $value : GetInfoZm($add[title]); } //处理函数 $value = DoFFun($modid, $f, $value, 1, 0); //检测必填字段 if ($ch == 1 && empty($add['titleurl'])) { ChMustAddF($modid, $f, $value); ChIsOnlyAddF($modid, 0, $f, $value, 0); //唯一值 } //编辑器 if ($f == "newstext") { //远程保存 $value = addslashes(CopyImg(stripSlashes($value), $add[copyimg], $add[copyflash], $add[classid], $add[qz_url], $username, $add['id'], $add['filepass'], $add['mark'])); //替换关键字和字符 $value = DoReplaceKeyAndWord($value, $add['dokey']); //自动分页 if ($add[autopage] && !strstr($value, "[!--empirenews.page--]")) { if (empty($add[autosize])) { $add[autosize] = 5000; } $value = AutoDoPage($value, $add[autosize]); } } //存文本 if ($emod_r[$modid]['savetxtf'] && $f == $emod_r[$modid]['savetxtf']) { //建立目录 $thetxtfile = GetFileMd5(); $truevalue = MkDirTxtFile(date("Y/md"), $thetxtfile); //写放文件 EditTxtFieldText($truevalue, $value); $value = $truevalue; } if (strstr($emod_r[$modid]['tbdataf'], ',' . $f . ',')) { $ret_r['datafields'] .= "," . $f; $ret_r['datavalues'] .= ",'" . addslashes($value) . "'"; } else { $ret_r['fields'] .= "," . $f; $ret_r['values'] .= ",'" . addslashes($value) . "'"; } } } elseif ($do == 1) { //数据库操作 for ($i = 1; $i < $count; $i++) { $f = $r[$i]; if ($f == "special.field" || !strstr($emod_r[$modid]['caneditf'], ',' . $f . ',')) { continue; } $add[$f] = ReturnCheckboxAddF($add[$f], $modid, $f); //复选框 $value = RepPhpAspJspcodeText($add[$f]); if ($f == 'newstime') { $value = empty($value) ? time() : to_time($value); } elseif ($f == "morepic") { $value = ReturnMorepicpath($add['msmallpic'], $add['mbigpic'], $add['mpicname'], $add['mdelpicid'], $add['mpicid'], $add, $add['mpicurl_qz'], 1); } elseif ($f == "downpath") { $value = ReturnDownpath($add['downname'], $add['downpath'], $add['delpathid'], $add['pathid'], $add['downuser'], $add['fen'], $add['thedownqz'], $add, $add['foruser'], $add['downurl_qz'], 1); } elseif ($f == "onlinepath") { $value = ReturnDownpath($add['odownname'], $add['odownpath'], $add['odelpathid'], $add['opathid'], $add['odownuser'], $add['ofen'], $add['othedownqz'], $add, $add['oforuser'], $add['onlineurl_qz'], 1); } elseif ($f == "smalltext") { if (!trim($value)) { $value = SubSmalltextVal($add[newstext], $public_r[smalltextlen]); //截取新闻内容 } } elseif ($f == 'infozm') { $value = $value ? $value : GetInfoZm($add[title]); } //处理函数 $value = DoFFun($modid, $f, $value, 0, 0); //检测必填字段 if ($ch == 1 && empty($add['titleurl'])) { ChMustAddF($modid, $f, $value); ChIsOnlyAddF($modid, $add[id], $f, $value, 0); //唯一值 } //数据同步 SameDataAddF($add[id], $add[classid], $modid, $f, $value); //内容 if ($f == "newstext") { //远程保存 $value = addslashes(CopyImg(stripSlashes($value), $add[copyimg], $add[copyflash], $add[classid], $add[qz_url], $username, $add['id'], $add['filepass'], $add['mark'])); //自动分页 if ($add[autopage] && !strstr($value, "[!--empirenews.page--]")) { if (empty($add[autosize])) { $add[autosize] = 5000; } $value = AutoDoPage($value, $add[autosize]); } } //存文本 if ($emod_r[$modid]['savetxtf'] && $f == $emod_r[$modid]['savetxtf']) { //建立目录 $newstexttxt_r = explode("/", $add[newstext_url]); $thetxtfile = $newstexttxt_r[2]; $truevalue = MkDirTxtFile($newstexttxt_r[0] . "/" . $newstexttxt_r[1], $thetxtfile); //写放文件 EditTxtFieldText($truevalue, $value); $value = $truevalue; } if (strstr($emod_r[$modid]['tbdataf'], ',' . $f . ',')) { $ret_r['datafields'] .= "," . $f; $ret_r['datavalues'] .= "," . $f . "='" . addslashes($value) . "'"; } else { $ret_r['fields'] .= "," . $f; $ret_r['values'] .= "," . $f . "='" . addslashes($value) . "'"; } } } elseif ($do == 8) { //数据库操作 for ($i = 1; $i < $count; $i++) { $f = $r[$i]; if ($f == 'special.field') { continue; } $value = $add[$f]; //存文本 if ($emod_r[$modid]['savetxtf'] && $f == $emod_r[$modid]['savetxtf']) { //建立目录 $newstexttxt_r = explode("/", $add[newstext_url]); $thetxtfile = $newstexttxt_r[2]; $truevalue = MkDirTxtFile($newstexttxt_r[0] . "/" . $newstexttxt_r[1], $thetxtfile); //写放文件 EditTxtFieldText($truevalue, $value); $value = $truevalue; } if (strstr($emod_r[$modid]['tbdataf'], ',' . $f . ',')) { $ret_r['datafields'] .= "," . $f; $ret_r['datavalues'] .= "," . $f . "='" . StripAddsData($value) . "'"; } else { $ret_r['fields'] .= "," . $f; $ret_r['values'] .= "," . $f . "='" . StripAddsData($value) . "'"; } } } elseif ($do == 9) { //数据库操作 for ($i = 1; $i < $count; $i++) { $f = $r[$i]; if ($f == 'special.field') { continue; } $value = $add[$f]; //存文本 if ($emod_r[$modid]['savetxtf'] && $f == $emod_r[$modid]['savetxtf']) { //建立目录 $thetxtfile = GetFileMd5(); $truevalue = MkDirTxtFile(date("Y/md"), $thetxtfile); //写放文件 EditTxtFieldText($truevalue, $value); $value = $truevalue; } if (strstr($emod_r[$modid]['tbdataf'], ',' . $f . ',')) { $ret_r['datafields'] .= "," . $f; $ret_r['datavalues'] .= ",'" . StripAddsData($value) . "'"; } else { $ret_r['fields'] .= "," . $f; $ret_r['values'] .= ",'" . StripAddsData($value) . "'"; } } } elseif ($do == 10) { //数据库操作 for ($i = 1; $i < $count; $i++) { $f = $r[$i]; if ($f == 'special.field') { continue; } $value = $add[$f]; if (strstr($emod_r[$modid]['tbdataf'], ',' . $f . ',')) { $ret_r['datafields'] .= "," . $f; $ret_r['datavalues'] .= ",'" . StripAddsData($value) . "'"; } else { $ret_r['fields'] .= "," . $f; $ret_r['values'] .= ",'" . StripAddsData($value) . "'"; } } } return $ret_r; }
function GetCjDownpath($text, $text1, $exp, $exp1, $url, $online = 0) { global $empire, $fun_r; if ($online) { $fun_r[DownPath] = ""; } $e1 = "[phome-" . $exp . "]"; $e2 = "[/phome-" . $exp . "]"; $ep1 = "[phome-" . $exp1 . "]"; $ep2 = "[/phome-" . $exp1 . "]"; $r = explode($e1, $text); //名称 if ($text1) { $rp = explode($ep1, $text1); } $p = 0; for ($i = 1; $i < count($r); $i++) { $r1 = explode($e2, $r[$i]); $dourl = trim($r1[0]); if (empty($dourl)) { continue; } if (!strstr($dourl, "://")) { $dourl = $url . $dourl; } if ($text1) { $rp1 = explode($ep2, $rp[$i]); $doname = trim($rp1[0]); if (empty($doname)) { $doname = $fun_r[DownPath] . ($p + 1); } } else { $doname = $fun_r[DownPath] . ($p + 1); } $downname[$p] = $doname; $downpath[$p] = $dourl; $p++; } $down = ReturnDownpath($downname, $downpath, $delpathid, $pathid, $downuser, $fen, $thedownqz, $add, $foruser, $downurl, 0); return $down; }