function DelTruePathFile($level, $path, $filename, $userid, $username) { global $empire, $dbtbpre, $public_r; $count = count($filename); if (empty($count)) { printerror("NotFileid", "history.go(-1)"); } //基目录 $basepath = ECMS_PATH . $path; for ($i = 0; $i < $count; $i++) { if (!$filename[$i] || !eReturnCkCFile($filename[$i])) { continue; } DelFiletext($basepath . "/" . $filename[$i]); } //操作日志 insert_dolog("path={$path}"); printerror("DelFileSuccess", $_SERVER['HTTP_REFERER']); }
function DelPrintTemp($add, $userid, $username) { global $empire, $dbtbpre, $public_r; $tempid = (int) $add[tempid]; if (empty($tempid)) { printerror("NotChangePrintTempid", "history.go(-1)"); } //验证权限 CheckLevel($userid, $username, $classid, "template"); $gid = (int) $add['gid']; $r = $empire->fetch1("select tempname,isdefault from " . GetDoTemptb("enewsprinttemp", $gid) . " where tempid={$tempid}"); if ($r['isdefault']) { printerror("NotDelDefPrintTempid", "history.go(-1)"); } $sql = $empire->query("delete from " . GetDoTemptb("enewsprinttemp", $gid) . " where tempid={$tempid}"); if ($gid == $public_r['deftempid'] || !$public_r['deftempid'] && ($gid == 1 || $gid == 0)) { DelFiletext(ECMS_PATH . DASHBOARD . '/data/filecache/template/print' . $tempid . '.php'); } //删除备份记录 DelEbakTempAll('printtemp', $gid, $tempid); if ($sql) { //操作日志 insert_dolog("tempid={$tempid}&tempname={$r['tempname']}&gid={$gid}"); printerror("DelPrintTempSuccess", "ListPrinttemp.php?gid={$gid}" . hReturnEcmsHashStrHref2(0)); } else { printerror("DbError", "history.go(-1)"); } }
function DelTxtFieldText($pagetexturl) { global $do_txtpath; if (empty($pagetexturl)) { return ''; } $file = $do_txtpath . $pagetexturl . ".php"; DelFiletext($file); }
function Ebak_DoTranExecSql($file, $file_name, $file_type, $file_size, $add) { global $empire, $phome_db_dbname, $phome_db_ver, $phome_db_char; if (!$file_name || !$file_size) { printerror("NotChangeSQLFile", "history.go(-1)"); } $filetype = GetFiletype($file_name); //取得扩展名 if ($filetype != ".sql") { printerror("NotTranSQLFile", "history.go(-1)"); } //上传文件 $newfile = 'tmp/uploadsql' . time() . '.sql'; $cp = Ebak_DoTranFile($file, $newfile); if (empty($cp)) { printerror("TranSQLFileFail", "history.go(-1)"); } $query = ReadFiletext($newfile); DelFiletext($newfile); if (!$query) { printerror("EmptyRunSql", "history.go(-1)"); } //数据库 if ($add['mydbname']) { $empire->query("use `" . $add['mydbname'] . "`"); } //编码 if ($add['mydbchar']) { DoSetDbChar($add['mydbchar']); } Ebak_DoRunQuery($query, $add['mydbchar'], $phome_db_ver); printerror("RunSqlSuccess", "DoSql.php"); }
function DelPicJs($picid) { $filename = "../../../d/js/pic/pic_" . $picid . ".js"; DelFiletext($filename); }
function SetEnews($add, $userid, $username) { global $empire, $dbtbpre; //操作权限 CheckLevel($userid, $username, $classid, "public"); $add[newsurl] = ehtmlspecialchars($add[newsurl], ENT_QUOTES); if (empty($add[indextype])) { $add[indextype] = ".html"; } if (empty($add[searchtype])) { $add[searchtype] = ".html"; } //备份目录 if (empty($add[bakdbpath])) { $add[bakdbpath] = "bdata"; } if (!file_exists("ebak/" . RepPathStr($add[bakdbpath]))) { printerror("NotBakDbPath", ""); } if (empty($add[bakdbzip])) { $add[bakdbzip] = "zip"; } if (!file_exists("ebak/" . RepPathStr($add[bakdbzip]))) { printerror("NotbakZipPath", ""); } //函数是否存在 if (!function_exists($add['listpagefun']) || !function_exists($add['textpagefun']) || !function_exists($add['listpagelistfun'])) { printerror("NotPageFun", "history.go(-1)"); } //adfile $add['adfile'] = RepFilenameQz($add['adfile']); //修改ftp密码 if ($add[ftppassword]) { $a = "ftppassword='******'ftppassword']}',"; } //变量处理 $add[filesize] = (int) $add[filesize]; $add[hotnum] = (int) $add[hotnum]; $add[newnum] = (int) $add[newnum]; $add[relistnum] = (int) $add[relistnum]; $add[renewsnum] = (int) $add[renewsnum]; $add[min_keyboard] = (int) $add[min_keyboard]; $add[max_keyboard] = (int) $add[max_keyboard]; $add[search_num] = (int) $add[search_num]; $add[search_pagenum] = (int) $add[search_pagenum]; $add[newslink] = (int) $add[newslink]; $add[checked] = (int) $add[checked]; $add[searchtime] = (int) $add[searchtime]; $add[loginnum] = (int) $add[loginnum]; $add[logintime] = (int) $add[logintime]; $add[addnews_ok] = (int) $add[addnews_ok]; $add[register_ok] = (int) $add[register_ok]; $add[goodlencord] = (int) $add[goodlencord]; $add[goodnum] = (int) $add[goodnum]; $add[exittime] = (int) $add[exittime]; $add[smalltextlen] = (int) $add[smalltextlen]; $add[defaultgroupid] = (int) $add[defaultgroupid]; $add[phpmode] = (int) $add[phpmode]; $add[install] = (int) $add[install]; $add[hotplnum] = (int) $add[hotplnum]; $add[dorepnum] = (int) $add[dorepnum]; $add[loadtempnum] = (int) $add[loadtempnum]; $add[firstnum] = (int) $add[firstnum]; $add[min_userlen] = (int) $add[min_userlen]; $add[max_userlen] = (int) $add[max_userlen]; $add[min_passlen] = (int) $add[min_passlen]; $add[max_passlen] = (int) $add[max_passlen]; $add[filechmod] = (int) $add[filechmod]; $add[sametitle] = (int) $add[sametitle]; $add[addrehtml] = (int) $add[addrehtml]; $add[loginkey_ok] = (int) $add[loginkey_ok]; $add[limittype] = (int) $add[limittype]; $add[redodown] = (int) $add[redodown]; $add[candocode] = (int) $add[candocode]; $add[opennotcj] = (int) $add[opennotcj]; $add[reuserpagenum] = (int) $add[reuserpagenum]; $add[revotejsnum] = (int) $add[revotejsnum]; $add[readjsnum] = (int) $add[readjsnum]; $add[qaddtran] = (int) $add[qaddtran]; $add[qaddtransize] = (int) $add[qaddtransize]; $add[ebakthisdb] = (int) $add[ebakthisdb]; $add[delnewsnum] = (int) $add[delnewsnum]; $add[markpos] = (int) $add[markpos]; $add[adminloginkey] = (int) $add[adminloginkey]; $add[php_outtime] = (int) $add[php_outtime]; $add[addreinfo] = (int) $add[addreinfo]; $add[rssnum] = (int) $add[rssnum]; $add[rsssub] = (int) $add[rsssub]; $add[dorepdlevelnum] = (int) $add[dorepdlevelnum]; $add[listpagelistnum] = (int) $add[listpagelistnum]; $add[infolinknum] = (int) $add[infolinknum]; $add[searchgroupid] = (int) $add[searchgroupid]; $add[opencopytext] = (int) $add[opencopytext]; $add[reuserjsnum] = (int) $add[reuserjsnum]; $add[reuserlistnum] = (int) $add[reuserlistnum]; $add[opentitleurl] = (int) $add[opentitleurl]; $add['qaddtranfile'] = (int) $add['qaddtranfile']; $add['qaddtranfilesize'] = (int) $add['qaddtranfilesize']; $add['sendmailtype'] = (int) $add['sendmailtype']; $add['loginemail'] = (int) $add['loginemail']; $add['feedbacktfile'] = (int) $add['feedbacktfile']; $add['feedbackfilesize'] = (int) $add['feedbackfilesize']; $add['searchtempvar'] = (int) $add['searchtempvar']; $add['showinfolevel'] = (int) $add['showinfolevel']; $add['spicwidth'] = (int) $add['spicwidth']; $add['spicheight'] = (int) $add['spicheight']; $add['spickill'] = (int) $add['spickill']; $add['jpgquality'] = (int) $add['jpgquality']; $add['markpct'] = (int) $add['markpct']; $add['redoview'] = (int) $add['redoview']; $add['reggetfen'] = (int) $add['reggetfen']; $add['regbooktime'] = (int) $add['regbooktime']; $add['revotetime'] = (int) $add['revotetime']; $add['fpath'] = (int) $add['fpath']; $add['openmembertranimg'] = (int) $add['openmembertranimg']; $add['memberimgsize'] = (int) $add['memberimgsize']; $add['openmembertranfile'] = (int) $add['openmembertranfile']; $add['memberfilesize'] = (int) $add['memberfilesize']; $add['openspace'] = (int) $add['openspace']; $add['realltime'] = (int) $add['realltime']; $add['textpagelistnum'] = (int) $add['textpagelistnum']; $add['memberlistlevel'] = (int) $add['memberlistlevel']; $add['ebakcanlistdb'] = (int) $add['ebakcanlistdb']; $add['keytog'] = (int) $add['keytog']; $add['keytime'] = (int) $add['keytime']; $add['regkey_ok'] = (int) $add['regkey_ok']; $add['opengetdown'] = (int) $add['opengetdown']; $add['gbkey_ok'] = (int) $add['gbkey_ok']; $add['fbkey_ok'] = (int) $add['fbkey_ok']; $add['newaddinfotime'] = (int) $add['newaddinfotime']; $add['classnavline'] = (int) $add['classnavline']; $add['docnewsnum'] = (int) $add['docnewsnum']; $add['dtcanbq'] = (int) $add['dtcanbq']; $add['dtcachetime'] = (int) $add['dtcachetime']; $add['regretime'] = (int) $add['regretime']; $add['regemailonly'] = (int) $add['regemailonly']; $add['repkeynum'] = (int) $add['repkeynum']; $add['getpasstime'] = (int) $add['getpasstime']; $add['acttime'] = (int) $add['acttime']; $add['regacttype'] = (int) $add['regacttype']; $add['opengetpass'] = (int) $add['opengetpass']; $add['hlistinfonum'] = (int) $add['hlistinfonum']; if (empty($add['hlistinfonum'])) { $add['hlistinfonum'] = 30; } $add['qlistinfonum'] = (int) $add['qlistinfonum']; if (empty($add['qlistinfonum'])) { $add['qlistinfonum'] = 30; } $add['dtncanbq'] = (int) $add['dtncanbq']; $add['dtncachetime'] = (int) $add['dtncachetime']; $add['readdinfotime'] = (int) $add['readdinfotime']; $add['qeditinfotime'] = (int) $add['qeditinfotime']; $add['ftpmode'] = (int) $add['ftpmode']; $add['ftpssl'] = (int) $add['ftpssl']; $add['ftppasv'] = (int) $add['ftppasv']; $add['ftpouttime'] = (int) $add['ftpouttime']; $add['onclicktype'] = (int) $add['onclicktype']; $add['onclickfilesize'] = (int) $add['onclickfilesize']; $add['onclickfiletime'] = (int) $add['onclickfiletime']; $add['closeqdt'] = (int) $add['closeqdt']; $add['settop'] = (int) $add['settop']; $add['qlistinfomod'] = (int) $add['qlistinfomod']; $add['gb_num'] = (int) $add['gb_num']; $add['member_num'] = (int) $add['member_num']; $add['space_num'] = (int) $add['space_num']; $add['infolday'] = (int) $add['infolday']; $add['filelday'] = (int) $add['filelday']; $add['baktempnum'] = (int) $add['baktempnum']; $add['dorepkey'] = (int) $add['dorepkey']; $add['dorepword'] = (int) $add['dorepword']; $add['indexpagedt'] = (int) $add['indexpagedt']; $add['closeqdtmsg'] = AddAddsData($add['closeqdtmsg']); $add['openfileserver'] = (int) $add['openfileserver']; $add['fieldandtop'] = (int) $add['fieldandtop']; $add['fieldandclosetb'] = $add['fieldandclosetb'] ? ',' . $add['fieldandclosetb'] . ',' : ''; $add['firsttitlename'] = ehtmlspecialchars(str_replace("\r\n", "|", $add['firsttitlename'])); $add['isgoodname'] = ehtmlspecialchars(str_replace("\r\n", "|", $add['isgoodname'])); $add['closelisttemp'] = ehtmlspecialchars($add['closelisttemp']); $add['ipaddinfonum'] = (int) $add['ipaddinfonum']; $add['ipaddinfotime'] = (int) $add['ipaddinfotime']; $add['indexaddpage'] = (int) $add['indexaddpage']; $add['modmemberedittran'] = (int) $add['modmemberedittran']; $add['modinfoedittran'] = (int) $add['modinfoedittran']; //提交IP $doiptypes = ''; $doiptype = $add['doiptype']; $doiptypecount = count($doiptype); if ($doiptypecount) { $doiptypes = ','; for ($di = 0; $di < $doiptypecount; $di++) { $doiptypes .= $doiptype[$di] . ','; } } //关闭相关模块 $closemodss = ''; $closemods = $add['closemods']; $closemodscount = count($closemods); if ($closemodscount) { $closemodss = ','; for ($cmi = 0; $cmi < $closemodscount; $cmi++) { $closemodss .= $closemods[$cmi] . ','; } } //关闭后台菜单 $closehmenus = ''; $closehmenu = $add['closehmenu']; $closehmenucount = count($closehmenu); if ($closehmenucount) { $closehmenus = ','; for ($chmi = 0; $chmi < $closehmenucount; $chmi++) { $closehmenus .= $closehmenu[$chmi] . ','; } } //限制操作的时间点 $timecloses = ''; $timeclose = $add['timeclose']; $timeclosecount = count($timeclose); if ($timeclosecount) { $timecloses = ','; for ($tci = 0; $tci < $timeclosecount; $tci++) { $timecloses .= $timeclose[$tci] . ','; } } //限制使用时间的操作 $timeclosedos = ''; $timeclosedo = $add['timeclosedo']; $timeclosedocount = count($timeclosedo); if ($timeclosedocount) { $timeclosedos = ','; for ($tcdi = 0; $tcdi < $timeclosedocount; $tcdi++) { $timeclosedos .= $timeclosedo[$tcdi] . ','; } } $add[filetype] = "|" . $add[filetype] . "|"; $add[qimgtype] = "|" . $add['qaddtranimgtype'] . "|"; $add[qfiletype] = "|" . $add['qaddtranfiletype'] . "|"; $add[feedbackfiletype] = "|" . $add['feedbackfiletype'] . "|"; $add[memberimgtype] = "|" . $add['memberimgtype'] . "|"; $add[memberfiletype] = "|" . $add['memberfiletype'] . "|"; $sql = $empire->query("update {$dbtbpre}enewspublic set " . $a . "sitename='{$add['sitename']}',newsurl='{$add['newsurl']}',email='{$add['email']}',filetype='{$add['filetype']}',filesize={$add['filesize']},hotnum={$add['hotnum']},newnum={$add['newnum']},relistnum={$add['relistnum']},renewsnum={$add['renewsnum']},min_keyboard={$add['min_keyboard']},max_keyboard={$add['max_keyboard']},search_num={$add['search_num']},search_pagenum={$add['search_pagenum']},newslink={$add['newslink']},checked={$add['checked']},searchtime={$add['searchtime']},loginnum={$add['loginnum']},logintime={$add['logintime']},addnews_ok={$add['addnews_ok']},register_ok={$add['register_ok']},indextype='{$add['indextype']}',goodlencord={$add['goodlencord']},goodtype='{$add['goodtype']}',goodnum={$add['goodnum']},searchtype='{$add['searchtype']}',exittime={$add['exittime']},smalltextlen={$add['smalltextlen']},defaultgroupid={$add['defaultgroupid']},fileurl='{$add['fileurl']}',phpmode={$add['phpmode']},ftphost='{$add['ftphost']}',ftpport='{$add['ftpport']}',ftpusername='******'ftpusername']}',ftppath='{$add['ftppath']}',ftpmode='{$add['ftpmode']}',install={$add['install']},hotplnum={$add['hotplnum']},dorepnum={$add['dorepnum']},loadtempnum={$add['loadtempnum']},firstnum={$add['firstnum']},bakdbpath='{$add['bakdbpath']}',bakdbzip='{$add['bakdbzip']}',downpass='******'downpass']}',min_userlen={$add['min_userlen']},max_userlen={$add['max_userlen']},min_passlen={$add['min_passlen']},max_passlen={$add['max_passlen']},filechmod={$add['filechmod']},loginkey_ok={$add['loginkey_ok']},limittype={$add['limittype']},redodown={$add['redodown']},candocode={$add['candocode']},opennotcj={$add['opennotcj']},reuserpagenum={$add['reuserpagenum']},revotejsnum={$add['revotejsnum']},readjsnum={$add['readjsnum']},qaddtran={$add['qaddtran']},qaddtransize={$add['qaddtransize']},ebakthisdb={$add['ebakthisdb']},delnewsnum={$add['delnewsnum']},markpos={$add['markpos']},markimg='{$add['markimg']}',marktext='{$add['marktext']}',markfontsize='{$add['markfontsize']}',markfontcolor='{$add['markfontcolor']}',markfont='{$add['markfont']}',adminloginkey={$add['adminloginkey']},php_outtime={$add['php_outtime']},listpagefun='{$add['listpagefun']}',textpagefun='{$add['textpagefun']}',adfile='{$add['adfile']}',notsaveurl='{$add['notsaveurl']}',rssnum={$add['rssnum']},rsssub={$add['rsssub']},dorepdlevelnum={$add['dorepdlevelnum']},listpagelistfun='{$add['listpagelistfun']}',listpagelistnum={$add['listpagelistnum']},infolinknum={$add['infolinknum']},searchgroupid={$add['searchgroupid']},opencopytext={$add['opencopytext']},reuserjsnum={$add['reuserjsnum']},reuserlistnum={$add['reuserlistnum']},opentitleurl='{$add['opentitleurl']}',qaddtranimgtype='{$add['qimgtype']}',qaddtranfile={$add['qaddtranfile']},qaddtranfilesize={$add['qaddtranfilesize']},qaddtranfiletype='{$add['qfiletype']}',sendmailtype={$add['sendmailtype']},smtphost='{$add['smtphost']}',fromemail='{$add['fromemail']}',loginemail={$add['loginemail']},emailusername='******'emailusername']}',emailpassword='******'emailpassword']}',smtpport='{$add['smtpport']}',emailname='{$add['emailname']}',feedbacktfile={$add['feedbacktfile']},feedbackfilesize={$add['feedbackfilesize']},feedbackfiletype='{$add['feedbackfiletype']}',searchtempvar={$add['searchtempvar']},showinfolevel={$add['showinfolevel']},navfh='" . eaddslashes($add[navfh]) . "',spicwidth={$add['spicwidth']},spicheight={$add['spicheight']},spickill={$add['spickill']},jpgquality={$add['jpgquality']},markpct={$add['markpct']},redoview={$add['redoview']},reggetfen={$add['reggetfen']},regbooktime={$add['regbooktime']},revotetime={$add['revotetime']},fpath={$add['fpath']},filepath='{$add['filepath']}',openmembertranimg={$add['openmembertranimg']},memberimgsize={$add['memberimgsize']},openmembertranfile={$add['openmembertranfile']},memberfilesize={$add['memberfilesize']},memberimgtype='{$add['memberimgtype']}',memberfiletype='{$add['memberfiletype']}',canposturl='{$add['canposturl']}',openspace='{$add['openspace']}',realltime={$add['realltime']},closeip='{$add['closeip']}',openip='{$add['openip']}',hopenip='{$add['hopenip']}',closewords='{$add['closewords']}',closewordsf='{$add['closewordsf']}',textpagelistnum={$add['textpagelistnum']},memberlistlevel={$add['memberlistlevel']},ebakcanlistdb={$add['ebakcanlistdb']},keytog='{$add['keytog']}',keyrnd='{$add['keyrnd']}',keytime='{$add['keytime']}',regkey_ok='{$add['regkey_ok']}',opengetdown='{$add['opengetdown']}',gbkey_ok='{$add['gbkey_ok']}',fbkey_ok='{$add['fbkey_ok']}',newaddinfotime='{$add['newaddinfotime']}',classnavline='{$add['classnavline']}',classnavfh='" . eaddslashes($add[classnavfh]) . "',sitekey='{$add['sitekey']}',siteintro='{$add['siteintro']}',docnewsnum='{$add['docnewsnum']}',dtcanbq='{$add['dtcanbq']}',dtcachetime='{$add['dtcachetime']}',regretime='{$add['regretime']}',regclosewords='{$add['regclosewords']}',regemailonly='{$add['regemailonly']}',repkeynum='{$add['repkeynum']}',getpasstime='{$add['getpasstime']}',acttime='{$add['acttime']}',regacttype='{$add['regacttype']}',acttext='" . eaddslashes($add[acttext]) . "',getpasstext='" . eaddslashes($add[getpasstext]) . "',acttitle='" . eaddslashes($add[acttitle]) . "',getpasstitle='" . eaddslashes($add[getpasstitle]) . "',opengetpass='******'opengetpass']}',hlistinfonum='{$add['hlistinfonum']}',qlistinfonum='{$add['qlistinfonum']}',dtncanbq='{$add['dtncanbq']}',dtncachetime='{$add['dtncachetime']}',readdinfotime='{$add['readdinfotime']}',qeditinfotime='{$add['qeditinfotime']}',ftpssl='{$add['ftpssl']}',ftppasv='{$add['ftppasv']}',ftpouttime='{$add['ftpouttime']}',onclicktype='{$add['onclicktype']}',onclickfilesize='{$add['onclickfilesize']}',onclickfiletime='{$add['onclickfiletime']}',closeqdt='{$add['closeqdt']}',settop='{$add['settop']}',qlistinfomod='{$add['qlistinfomod']}',gb_num='{$add['gb_num']}',member_num='{$add['member_num']}',space_num='{$add['space_num']}',opendoip='{$add['opendoip']}',closedoip='{$add['closedoip']}',doiptype='{$doiptypes}',infolday='{$add['infolday']}',filelday='{$add['filelday']}',baktempnum='{$add['baktempnum']}',dorepkey='{$add['dorepkey']}',dorepword='{$add['dorepword']}',onclickrnd='{$add['onclickrnd']}',indexpagedt='{$add['indexpagedt']}',keybgcolor='{$add['keybgcolor']}',keyfontcolor='{$add['keyfontcolor']}',keydistcolor='{$add['keydistcolor']}',closeqdtmsg='{$add['closeqdtmsg']}',openfileserver='{$add['openfileserver']}',closemods='{$closemodss}',fieldandtop='{$add['fieldandtop']}',fieldandclosetb='{$add['fieldandclosetb']}',firsttitlename='" . eaddslashes($add[firsttitlename]) . "',isgoodname='" . eaddslashes($add[isgoodname]) . "',closelisttemp='" . eaddslashes($add[closelisttemp]) . "',chclasscolor='" . eaddslashes($add[chclasscolor]) . "',timeclose='" . eaddslashes($timecloses) . "',timeclosedo='" . eaddslashes($timeclosedos) . "',ipaddinfonum='{$add['ipaddinfonum']}',ipaddinfotime='{$add['ipaddinfotime']}',closehmenu='{$closehmenus}',indexaddpage='{$add['indexaddpage']}',modmemberedittran='{$add['modmemberedittran']}',modinfoedittran='{$add['modinfoedittran']}';"); DoSetFileServer($add); //远程附件更新 GetConfig(); //首页动态文件 if ($add['indexpagedt'] != $add['oldindexpagedt']) { if ($add['indexpagedt']) { DelFiletext(ECMS_PATH . 'index' . $add[indextype]); @copy(ECMS_PATH . DASHBOARD . '/data/template/dtindexpage.txt', ECMS_PATH . 'index.php'); } else { DelFiletext(ECMS_PATH . 'index.php'); $indextemp = GetIndextemp(); NewsBq(0, $indextemp, 1, 0); } } if ($sql) { insert_dolog(""); //操作日志 printerror("SetPublicSuccess", "SetEnews.php" . hReturnEcmsHashStrHref2(1)); } else { printerror("DbError", "history.go(-1)"); } }
function DelVote($voteid, $userid, $username) { global $empire, $dbtbpre; $voteid = (int) $voteid; if (!$voteid) { printerror("NotDelVoteid", "history.go(-1)"); } //验证权限 CheckLevel($userid, $username, $classid, "vote"); $r = $empire->fetch1("select title from {$dbtbpre}enewsvote where voteid='{$voteid}'"); $sql = $empire->query("delete from {$dbtbpre}enewsvote where voteid='{$voteid}'"); $file = "../../../d/js/vote/vote" . $voteid . ".js"; DelFiletext($file); if ($sql) { //操作日志 insert_dolog("voteid=" . $voteid . "<br>title=" . $r[title]); printerror("DelVoteSuccess", "ListVote.php"); } else { printerror("DbError", "history.go(-1)"); } }
function DelAd($adid, $userid, $username) { global $empire, $time, $public_r, $dbtbpre; $adid = (int) $adid; if (!$adid) { printerror("NotDelAdid", "history.go(-1)"); } //验证权限 CheckLevel($userid, $username, $classid, "ad"); $r = $empire->fetch1("select title from {$dbtbpre}enewsad where adid='{$adid}'"); $sql = $empire->query("delete from {$dbtbpre}enewsad where adid='{$adid}'"); $file = "../../../d/js/acmsd/" . $public_r[adfile] . $adid . ".js"; DelFiletext($file); //删除附件 DelFileOtherTable("modtype=3 and id='{$adid}'"); if ($sql) { //操作日志 insert_dolog("adid=" . $adid . "<br>title=" . $r[title]); printerror("DelAdSuccess", "ListAd.php?time={$time}" . hReturnEcmsHashStrHref2(0)); } else { printerror("DbError", "history.go(-1)"); } }
function Ebak_DelZip($file,$userid,$username){ global $public_r; //验证权限 CheckLevel($userid,$username,$classid,"dbdata"); $file=RepPostStr($file,1); if(strstr($file,"..")) {printerror("FileNotExist","history.go(-1)");} if(empty($file)) { printerror("FileNotExist","history.go(-1)"); } $bakzippath=$public_r['bakdbzip']; $filename=$bakzippath."/".$file; if(!file_exists($filename)) { printerror("FileNotExist","history.go(-1)"); } DelFiletext($filename); //操作日志 insert_dolog("file=".$file); printerror("DelZipFileSuccess","history.go(-1)"); }
function Ebak_DelZip($file) { global $bakzippath; if (strstr($file, "..")) { printerror("FileNotExists", "history.go(-1)", 9); } if (empty($file)) { printerror("FileNotExists", "history.go(-1)", 9); } $filename = $bakzippath . "/" . $file; if (!file_exists($filename)) { printerror("FileNotExists", "history.go(-1)", 9); } DelFiletext($filename); printerror("DelZipSuccess", "history.go(-1)", 9); }
function DelPathFile($filename, $userid, $username) { global $empire, $dbtbpre, $public_r, $efileftp_dr; //操作权限 CheckLevel($userid, $username, $classid, "file"); $count = count($filename); if (empty($count)) { printerror("NotFileid", "history.go(-1)"); } //基目录 $basepath = eReturnEcmsMainPortPath() . "/data"; //moreport for ($i = 0; $i < $count; $i++) { if (strstr($filename[$i], "..")) { continue; } if (!file_exists($basepath . "/" . $filename[$i])) { continue; } DelFiletext($basepath . "/" . $filename[$i]); $dfile = ReturnPathFile($filename[$i]); $dfile = hRepPostStr($dfile, 1); $dfnum = $empire->gettotal("select count(*) as total from {$dbtbpre}enewsfile_1 where filename='{$dfile}'"); if ($dfnum) { $empire->query("delete from {$dbtbpre}enewsfile_1 where filename='{$dfile}'"); //FileServer if ($public_r['openfileserver']) { $efileftp_dr[] = $basepath . "/" . $filename[$i]; } } } //操作日志 insert_dolog(""); printerror("DelFileSuccess", $_SERVER['HTTP_REFERER']); }
function DelFeedbackClass($add, $userid, $username) { global $empire, $dbtbpre; $bid = (int) $add['bid']; if (!$bid) { printerror("NotChangeGbookClassid", "history.go(-1)"); } //验证权限 //CheckLevel($userid,$username,$classid,"feedbackf"); $r = $empire->fetch1("select bid,bname from {$dbtbpre}enewsfeedbackclass where bid={$bid};"); if (!$r['bid']) { printerror("NotChangeGbookClassid", "history.go(-1)"); } $sql = $empire->query("delete from {$dbtbpre}enewsfeedbackclass where bid={$bid};"); //删除附件 $fsql = $empire->query("select id,filepath,filename from {$dbtbpre}enewsfeedback where bid={$bid}"); while ($fr = $empire->fetch($fsql)) { DelFeedbackFile($fr['filename'], $fr['filepath']); } $sql1 = $empire->query("delete from {$dbtbpre}enewsfeedback where bid={$bid};"); //删除表单文件 $file = "../../tool/feedback/temp/feedback" . $bid . ".php"; DelFiletext($file); if ($sql) { //操作日志 insert_dolog("bid=" . $bid . "<br>bname=" . $r[bname]); printerror("DelGbookClassSuccess", "FeedbackClass.php"); } else { printerror("DbError", "history.go(-1)"); } }
function DelUser($userid, $loginuserid, $loginusername) { global $empire, $dbtbpre; $userid = (int) $userid; if (!$userid) { printerror("NotDelUserid", "history.go(-1)"); } //操作权限 CheckLevel($loginuserid, $loginusername, $classid, "user"); //验证是否最后一个管理员 $num = $empire->gettotal("select count(*) as total from {$dbtbpre}enewsuser"); if ($num <= 1) { printerror("LastUserNotToDel", "history.go(-1)"); } $r = $empire->fetch1("select username from {$dbtbpre}enewsuser where userid='{$userid}'"); $sql = $empire->query("delete from {$dbtbpre}enewsuser where userid='{$userid}'"); $sql1 = $empire->query("delete from {$dbtbpre}enewsuseradd where userid='{$userid}'"); if ($sql) { DelFiletext('../../data/fc/ListEnews' . $userid . '.php'); DelFiletext('../../data/fc/userclass' . $userid . '.js'); //删除导航缓存 $empire->query("delete from {$dbtbpre}enewsclassnavcache where navtype='userenews' and userid='{$userid}'"); //操作日志 insert_dolog("userid=" . $userid . "<br>username="******"DelUserSuccess", "ListUser.php" . hReturnEcmsHashStrHref2(1)); } else { printerror("DbError", "history.go(-1)"); } }
function DelTxtFieldText($pagetexturl) { global $ecms_config; if (empty($pagetexturl)) { return ''; } $file = $ecms_config['sets']['txtpath'] . $pagetexturl . ".php"; DelFiletext($file); }
function DelMemberForm($add, $userid, $username) { global $empire, $dbtbpre; $fid = (int) $add['fid']; if (!$fid) { printerror("EmptyMemberFormId", "history.go(-1)"); } //验证权限 CheckLevel($userid, $username, $classid, "memberf"); $r = $empire->fetch1("select fid,fname from {$dbtbpre}enewsmemberform where fid={$fid};"); if (!$r['fid']) { printerror("EmptyMemberFormId", "history.go(-1)"); } $sql = $empire->query("delete from {$dbtbpre}enewsmemberform where fid={$fid};"); //删除表单文件 $file = "../data/html/memberform" . $fid . ".php"; DelFiletext($file); if ($sql) { insert_dolog("fid=" . $fid . "<br>fname=" . $r[fname]); //操作日志 printerror("DelMemberFormSuccess", "member/ListMemberForm.php" . hReturnEcmsHashStrHref2(1)); } else { printerror("DbError", "history.go(-1)"); } }
function DoEDelFileRnd($userid) { $path = ECMS_PATH . 'e/data/adminlogin/'; $hand = @opendir($path); while ($file = @readdir($hand)) { if ($file == '.' || $file == '..') { continue; } if (strstr($file, 'user' . $userid . '_')) { DelFiletext($path . $file); } } }
function LoadInTempGroup($add, $file, $file_name, $file_type, $file_size, $userid, $username) { global $empire, $dbtbpre; //验证权限 CheckLevel($userid, $username, $classid, "tempgroup"); if (!$file_name || !$file_size) { printerror("EmptyLoadInTempGroup", ""); } $gid = (int) $add['gid']; //扩展名 $filetype = GetFiletype($file_name); if ($filetype != ".temp") { printerror("LoadInTempGroupMusttemp", ""); } //上传文件 $path = ECMS_PATH . DASHBOARD . '/data/tmp/temp/uploadtg' . time() . make_password(10) . '.temp'; $cp = @move_uploaded_file($file, $path); DoChmodFile($path); $data = ReadFiletext($path); DelFiletext($path); //转码 if ($add['ChangeChar']) { $data = LoadInTempChangeChar($add['tempchar'], $data); } if (empty($data)) { printerror("EmptyLoadInTempGroup", ""); } //返回版本 $pageexp = "<!---ecms.temp--->"; $checkpr = explode($pageexp, $data); $tempverr = LoadInTGReturnVer($checkpr[0]); $gname = $tempverr['gname']; $thistempver = $tempverr['ver']; $thistempchar = $tempverr['tempchar']; //替换旧地址 $GLOBALS['loadtempver'] = $thistempver; if (empty($thistempver)) { $data = LoadInTGReptext_pubvar($data); } //入库 $pageexp = "<!---ecms.temp--->"; $record = "<!---ecms.record--->"; $field = "<!---ecms.field--->"; $pr = explode($pageexp, $data); if (empty($gid)) { $sql = $empire->query("insert into {$dbtbpre}enewstempgroup(gname,isdefault) values('" . addslashes($gname) . "',0);"); $gid = $empire->lastid(); $gname = $pr[0]; $en = "_" . $gid; CreateTempTb($gid, $en); //复制表 } else { $r = $empire->fetch1("select gid,gname from {$dbtbpre}enewstempgroup where gid={$gid}"); if (!$r['gid']) { printerror("LoadInTempGroupMusttemp", ""); } if ($gid == 1) { $en = ""; } else { $en = "_" . $gid; } $gname = $r['gname']; ClearTempTb($gid, $en); //清空表 } //版本 $isold = 0; $ckcount = count($pr); if ($ckcount <= 10) { $isold = 1; } elseif ($ckcount <= 11) { $isold = 2; } LoadInTGBqtemp($gid, $en, $record, $field, $pr[1]); //标签模板 LoadInTGJstemp($gid, $en, $record, $field, $pr[2]); //JS模板 LoadInTGListtemp($gid, $en, $record, $field, $pr[3]); //列表模板 LoadInTGNewstemp($gid, $en, $record, $field, $pr[4]); //内容模板 LoadInTGPubtemp($gid, $en, $record, $field, $pr[5], $isold); //公共模板 LoadInTGSearchtemp($gid, $en, $record, $field, $pr[6]); //搜索模板 LoadInTGTempvar($gid, $en, $record, $field, $pr[7]); //模板变量 LoadInTGVotetemp($gid, $en, $record, $field, $pr[8]); //投票模板 LoadInTGClasstemp($gid, $en, $record, $field, $pr[9]); //栏目模板 if ($isold != 1) { LoadInTGPltemp($gid, $en, $record, $field, $pr[10]); //评论模板 } if ($isold == 0) { LoadInTGPrinttemp($gid, $en, $record, $field, $pr[11]); //打印模板 } LoadInTGPagetemp($gid, $en, $record, $field, $pr[12]); //自定义页面模板 //操作日志 insert_dolog("gid={$gid}&gname={$gname}"); printerror("LoadInTempGroupSuccess", "TempGroup.php" . hReturnEcmsHashStrHref2(1)); }
function EditUser($userid, $username, $password, $repassword, $groupid, $adminclass, $oldusername, $checked, $styleid, $loginuserid, $loginusername) { global $empire, $class_r, $dbtbpre; $userid = (int) $userid; if (!$userid || !$username) { printerror("EnterUsername", "history.go(-1)"); } //操作权限 CheckLevel($loginuserid, $loginusername, $classid, "user"); //修改用户名 if ($oldusername != $username) { $num = $empire->gettotal("select count(*) as total from {$dbtbpre}enewsuser where username='******' and userid<>{$userid} limit 1"); if ($num) { printerror("ReUsername", "history.go(-1)"); } //修改信息 //$nsql=$empire->query("update {$dbtbpre}enewsnews set username='******' where username='******'"); //修改日志 $lsql = $empire->query("update {$dbtbpre}enewslog set username='******' where username='******'"); $lsql = $empire->query("update {$dbtbpre}enewsdolog set username='******' where username='******'"); } //修改密码 if ($password) { if ($password != $repassword) { printerror("NotRepassword", "history.go(-1)"); } if (strlen($password) < 6) { printerror("LessPassword", "history.go(-1)"); } $salt = make_password(8); $password = md5(md5($password) . $salt); $add = ",password='******',salt='{$salt}'"; } //管理目录 for ($i = 0; $i < count($adminclass); $i++) { //大栏目 if (empty($class_r[$adminclass[$i]][islast])) { if (empty($class_r[$adminclass[$i]][sonclass]) || $class_r[$adminclass[$i]][sonclass] == "|") { continue; } else { $andclass = substr($class_r[$adminclass[$i]][sonclass], 1); } $insert_class .= $andclass; } else { $insert_class .= $adminclass[$i] . "|"; } } $insert_class = "|" . $insert_class; $styleid = (int) $styleid; $groupid = (int) $groupid; $checked = (int) $checked; $filelevel = (int) $_POST['filelevel']; $classid = (int) $_POST['classid']; $truename = htmlspecialchars($_POST['truename']); $email = htmlspecialchars($_POST['email']); $sql = $empire->query("update {$dbtbpre}enewsuser set username='******',groupid={$groupid},adminclass='{$insert_class}',checked={$checked},styleid={$styleid},filelevel='{$filelevel}',truename='{$truename}',email='{$email}',classid='{$classid}'" . $add . " where userid='{$userid}'"); //安全提问 $equestion = (int) $_POST['equestion']; $eanswer = $_POST['eanswer']; $uadd = ''; if ($equestion) { if ($equestion != $_POST['oldequestion'] && !$eanswer) { printerror('EmptyEAnswer', ''); } if ($eanswer) { $eanswer = ReturnHLoginQuestionStr($userid, $username, $equestion, $eanswer); $uadd = ",eanswer='{$eanswer}'"; } } else { $uadd = ",eanswer=''"; } $empire->query("update {$dbtbpre}enewsuseradd set equestion='{$equestion}'" . $uadd . " where userid='{$userid}'"); if ($_POST['oldadminclass'] != $insert_class) { DelFiletext('../../data/fc/ListEnews' . $userid . '.php'); } if ($sql) { //操作日志 insert_dolog("userid=" . $userid . "<br>username="******"EditUserSuccess", "ListUser.php"); } else { printerror("DbError", "history.go(-1)"); } }
function LoadInMod($add, $file, $file_name, $file_type, $file_size, $userid, $username) { global $empire, $dbtbpre, $phome_db_dbchar; //验证权限 CheckLevel($userid, $username, $classid, "table"); $tbname = RepPostVar(trim($add['tbname'])); if (!$file_name || !$file_size || !$tbname) { printerror("EmptyLoadInMod", ""); } //扩展名 $filetype = GetFiletype($file_name); if ($filetype != ".mod") { printerror("LoadInModMustmod", ""); } //表名是否已存在 $num = $empire->gettotal("select count(*) as total from {$dbtbpre}enewstable where tbname='{$tbname}' limit 1"); if ($num) { printerror("HaveLoadInTb", ""); } //上传文件 $path = ECMS_PATH . "e/data/tmp/mod/uploadm" . time() . make_password(10) . ".php"; $cp = @move_uploaded_file($file, $path); if (!$cp) { printerror("EmptyLoadInMod", ""); } DoChmodFile($path); @(include $path); UpdateTbDefMod($tid, $tbname, $mid); //公共变量 TogSaveTxtF(1); GetConfig(1); //更新缓存 //生成模型表单文件 $modr = $empire->fetch1("select mtemp,qmtemp,cj from {$dbtbpre}enewsmod where mid='{$mid}'"); ChangeMForm($mid, $tid, $modr[mtemp]); //更新表单 ChangeQmForm($mid, $tid, $modr[qmtemp]); //更新前台表单 ChangeMCj($mid, $tid, $modr[cj]); //采集表单 //删除文件 DelFiletext($path); //操作日志 insert_dolog("tid={$tid}&tb={$tbname}<br>mid={$mid}"); printerror("LoadInModSuccess", "db/ListTable.php"); }
function ChangeClassIslast($reclassid, $userid, $username) { global $empire, $dbtbpre; //操作权限 CheckLevel($userid, $username, $classid, "class"); $count = count($reclassid); $classid = (int) $reclassid[0]; if ($count == 0 || !$classid) { printerror("NotChangeIslastClassid", ""); } //取得本栏目信息 $r = $empire->fetch1("select classid,sonclass,featherclass,islist,islast,classname,modid,tbname,wburl from {$dbtbpre}enewsclass where classid={$classid}"); if (empty($r[classid])) { printerror("NotChangeIslastClassid", ""); } if ($r[wburl]) { printerror("NotChangeWbClassid", ""); } //非终极栏目 if (!$r[islast]) { $num = $empire->gettotal("select count(*) as total from {$dbtbpre}enewsclass where bclassid={$classid}"); if ($num) { printerror("LastTheClassHaveSonclass", "history.go(-1)"); } //修改父栏目的子栏目 $where = ReturnClass($r[featherclass]); if (empty($where)) { $where = "classid=0"; } $sql = $empire->query("select classid,sonclass from {$dbtbpre}enewsclass where " . $where); while ($br = $empire->fetch($sql)) { if (empty($br[sonclass])) { $br[sonclass] = "|"; } $newsonclass = $br[sonclass] . $classid . "|"; $usql = $empire->query("update {$dbtbpre}enewsclass set sonclass='{$newsonclass}' where classid={$br['classid']}"); } $dosql = $empire->query("update {$dbtbpre}enewsclass set islast=1 where classid={$classid}"); $mess = "ChangeClassToLastSuccess"; } else { $num = $empire->gettotal("select count(*) as total from {$dbtbpre}ecms_" . $r[tbname] . "_index where classid='{$classid}'"); if ($num) { printerror("LastTheClassHaveInfo", "history.go(-1)"); } //修改父栏目的子栏目 $where = ReturnClass($r[featherclass]); if (empty($where)) { $where = "classid=0"; } $sql = $empire->query("select classid,sonclass from {$dbtbpre}enewsclass where " . $where); while ($br = $empire->fetch($sql)) { if (empty($br[sonclass])) { $br[sonclass] = "|"; } $newsonclass = str_replace("|" . $classid . "|", "|", $br[sonclass]); $usql = $empire->query("update {$dbtbpre}enewsclass set sonclass='{$newsonclass}' where classid={$br['classid']}"); } $dosql = $empire->query("update {$dbtbpre}enewsclass set islast=0 where classid={$classid}"); $mess = "ChangeClassToNolastSuccess"; } //删除缓存文件 DelListEnews(); //更新缓存 GetClass(); //GetSearch($r[modid]); if ($dosql) { //删除导航缓存 $empire->query("delete from {$dbtbpre}enewsclassnavcache where navtype='listclass' or navtype='listenews' or navtype='jsclass' or navtype='userenews' or (navtype='modclass' and modid='{$r['modid']}')"); DelFiletext("../data/js/js/addinfo" . $r[modid] . ".js"); $cache_enews = 'doclass,doinfo,douserinfo,domod,dostemp'; $cache_ecmstourl = urlencode($_SERVER['HTTP_REFERER']); $cache_mess = $mess; $cache_mid = $r[modid]; $cache_url = "CreateCache.php?enews={$cache_enews}&mid={$cache_mid}&ecmstourl={$cache_ecmstourl}&mess={$cache_mess}" . hReturnEcmsHashStrHref2(0); //操作日志 insert_dolog("classid=" . $classid . "<br>classname=" . $r[classname]); //printerror($mess,$_SERVER['HTTP_REFERER']); echo '<meta http-equiv="refresh" content="0;url=' . $cache_url . '">'; db_close(); $empire = null; exit; } else { printerror("DbError", "history.go(-1)"); } }
function LoadInCj($add, $file, $file_name, $file_type, $file_size, $userid, $username) { global $empire, $dbtbpre; $lineexp = '<!-#-|-line-|-#-!>'; $recordexp = '<!-#-|-record-|-#-!>'; $fieldexp = '<!-#-|-field-|-#-!>'; $sfieldexp = '<!-#-|-smallfield-|-#-!>'; //验证权限 CheckLevel($userid, $username, $classid, "loadcj"); $classid = (int) $add['classid']; if (!$classid) { printerror("EmptyLoadInCjFile", "history.go(-1)"); } $cr = $empire->fetch1("select classid,islast,tid,tbname from {$dbtbpre}enewsclass where classid='{$classid}' and islast=1"); if (!$cr['classid']) { printerror("LoadInCjMustLastClass", "history.go(-1)"); } if (!$file_name || !$file_size) { printerror("EmptyLoadInCjFile", "history.go(-1)"); } //扩展名 $filetype = GetFiletype($file_name); if ($filetype != ".cj") { printerror("LoadInCjErrorfiletype", "history.go(-1)"); } $path = ECMS_PATH . DASHBOARD . '/data/tmp/cj/uploadcj' . time() . '.cj'; //上传文件 $cp = @move_uploaded_file($file, $path); DoChmodFile($path); $data = ReadFiletext($path); DelFiletext($path); $r = explode($recordexp, $data); $empirecmsver = $r[0]; $mainstr = $r[1]; $datafield = $r[2]; $datastr = $r[3]; if (empty($mainstr)) { printerror("EmptyLoadInCjFile", "history.go(-1)"); } //主表 $infoclassid = LoadInCjInsertMainstr($classid, $cr['tid'], $cr['tbname'], $mainstr, $fieldexp, $sfieldexp); //副表 LoadInCjInsertDatastr($classid, $cr['tid'], $cr['tbname'], $infoclassid, $datafield, $datastr, $fieldexp, $sfieldexp); $cjr = $empire->fetch1("select classname from {$dbtbpre}enewsinfoclass where classid='{$infoclassid}'"); //操作日志 insert_dolog("classid=" . $infoclassid . "<br>classname=" . $cjr[classname]); printerror("LoadInCjSuccess", "cj/LoadInCj.php?from=" . ehtmlspecialchars($_POST[from]) . hReturnEcmsHashStrHref2(0)); }
function fTranFile($hfile, $lfile, $startpos = 0, $del = 0) { $hfile = $this->wipespecial($hfile); $lfile = $this->wipespecial($lfile); $startpos = intval($startpos); $tran = @ftp_put($this->ftpconnectid, $hfile, $lfile, $this->ftptranmode, $startpos); if ($del) { DelFiletext($lfile); } return $tran; }
function ClearTmpFileData($add,$userid,$username){ global $empire,$public_r,$dbtbpre; //验证权限 CheckLevel($userid,$username,$classid,"changedata"); //临时文件目录 $tmppath=ECMS_PATH.DASHBOARD.'/data/tmp'; $hand=@opendir($tmppath); while($file=@readdir($hand)) { if($file=='.'||$file=='..'||$file=='test.txt'||$file=='index.html'||$file=='mod'||$file=='temp'||$file=='titlepic'||$file=='cj') { continue; } $filename=$tmppath.'/'.$file; if(!is_dir($filename)) { DelFiletext($filename); } } //临时模板导出目录 $temppath=ECMS_PATH.DASHBOARD.'/data/tmp/temp'; $hand=@opendir($temppath); while($file=@readdir($hand)) { if($file=='.'||$file=='..'||$file=='test.txt'||$file=='index.php') { continue; } $filename=$temppath.'/'.$file; if(!is_dir($filename)) { DelFiletext($filename); } } //临时模型导出目录 $modpath=ECMS_PATH.DASHBOARD.'/data/tmp/mod'; $hand=@opendir($modpath); while($file=@readdir($hand)) { if($file=='.'||$file=='..'||$file=='test.txt'||$file=='index.php') { continue; } $filename=$modpath.'/'.$file; if(!is_dir($filename)) { DelFiletext($filename); } } //临时采集导出目录 $cjpath=ECMS_PATH.DASHBOARD.'/data/tmp/cj'; $hand=@opendir($cjpath); while($file=@readdir($hand)) { if($file=='.'||$file=='..'||$file=='test.txt'||$file=='index.html') { continue; } $filename=$cjpath.'/'.$file; if(!is_dir($filename)) { DelFiletext($filename); } } //采集临时表 $empire->query("TRUNCATE `{$dbtbpre}enewslinktmp`;"); //远程发布临时表 $empire->query("TRUNCATE `{$dbtbpre}enewspostdata`;"); printerror('ClearTmpFileDataSuccess',''); }
function DoCropImage($add, $userid, $username) { global $empire, $dbtbpre, $public_r, $class_r, $ecms_config, $efileftp_fr, $efileftp_dr; //参数处理 $pic_x = (int) $add['pic_x']; $pic_y = (int) $add['pic_y']; $pic_w = (int) $add['pic_w']; $pic_h = (int) $add['pic_h']; $doing = (int) $add['doing']; $fileid = (int) $add['fileid']; $filepass = (int) $add['filepass']; $classid = (int) $add['classid']; $infoid = (int) $add['infoid']; $modtype = (int) $add['modtype']; $fstb = 0; if (empty($modtype)) { $fstb = GetInfoTranFstb($classid, $infoid, 0); } //取得文件地址 if (empty($fileid)) { printerror('NotCropImage', 'history.go(-1)'); } $filer = $empire->fetch1("select fileid,path,filename,classid,fpath,no from " . eReturnFileTable($modtype, $fstb) . " where fileid='{$fileid}'"); if (empty($filer['fileid'])) { printerror('NotCropImage', 'history.go(-1)'); } $path = $filer['path'] ? $filer['path'] . '/' : $filer['path']; $fspath = ReturnFileSavePath($filer['classid'], $filer['fpath']); $big_image_name = eReturnEcmsMainPortPath() . $fspath['filepath'] . $path . $filer['filename']; //moreport if (!file_exists($big_image_name)) { printerror('NotCropImage', 'history.go(-1)'); } $filetype = GetFiletype($filer['filename']); //取得文件类型 if (!strstr($ecms_config['sets']['tranpicturetype'], ',' . $filetype . ',')) { printerror('CropImageFiletypeFail', 'history.go(-1)'); } //目标图片 $new_datepath = FormatFilePath($filer['classid'], '', 0); $new_path = $new_datepath ? $new_datepath . '/' : $new_datepath; $new_insertfile = ReturnDoTranFilename($filer['filename'], 0); $new_fspath = ReturnFileSavePath($filer['classid']); $new_savepath = eReturnEcmsMainPortPath() . $new_fspath['filepath'] . $new_path; //moreport $new_name = $new_savepath . $new_insertfile; //处理图片 $returnr['file'] = ''; $returnr['filetype'] = ''; if ($temp_img_type = @getimagesize($big_image_name)) { preg_match('/\\/([a-z]+)$/i', $temp_img_type[mime], $tpn); $img_type = $tpn[1]; } else { preg_match('/\\.([a-z]+)$/i', $big_image_name, $tpn); $img_type = $tpn[1]; } $all_type = array("jpg" => array("create" => "ImageCreateFromjpeg", "output" => "imagejpeg", "exn" => ".jpg"), "gif" => array("create" => "ImageCreateFromGIF", "output" => "imagegif", "exn" => ".gif"), "jpeg" => array("create" => "ImageCreateFromjpeg", "output" => "imagejpeg", "exn" => ".jpg"), "png" => array("create" => "imagecreatefrompng", "output" => "imagepng", "exn" => ".png"), "wbmp" => array("create" => "imagecreatefromwbmp", "output" => "image2wbmp", "exn" => ".wbmp")); $func_create = $all_type[$img_type]['create']; if (empty($func_create) or !function_exists($func_create)) { printerror('CropImageFiletypeFail', 'history.go(-1)'); } //输出 $func_output = $all_type[$img_type]['output']; $func_exname = $all_type[$img_type]['exn']; if (($func_exname == '.gif' || $func_exname == '.png' || $func_exname == '.wbmp') && !function_exists($func_output)) { $func_output = 'imagejpeg'; $func_exname = '.jpg'; } $big_image = $func_create($big_image_name); $big_width = imagesx($big_image); $big_height = imagesy($big_image); if (!$big_width || !$big_height || $big_width < 10 || $big_height < 10) { printerror('CropImageFilesizeFail', 'history.go(-1)'); } if (function_exists("imagecopyresampled")) { $temp_image = imagecreatetruecolor($pic_w, $pic_h); imagecopyresampled($temp_image, $big_image, 0, 0, $pic_x, $pic_y, $pic_w, $pic_h, $pic_w, $pic_h); } else { $temp_image = imagecreate($pic_w, $pic_h); imagecopyresized($temp_image, $big_image, 0, 0, $pic_x, $pic_y, $pic_w, $pic_h, $pic_w, $pic_h); } $func_output($temp_image, $new_name . $func_exname); ImageDestroy($big_image); ImageDestroy($temp_image); $insert_file = $new_name . $func_exname; $insert_filename = $new_insertfile . $func_exname; if (file_exists($insert_file)) { if (!$doing) { $empire->query("delete from " . eReturnFileTable($modtype, $fstb) . " where fileid='{$fileid}'"); DelFiletext($big_image_name); //FileServer if ($public_r['openfileserver']) { $efileftp_dr[] = $big_image_name; } } //写入数据库 $no = '[CropImg]' . $filer['no']; $filesize = filesize($insert_file); $filesize = (int) $filesize; $classid = (int) $classid; $type = 1; eInsertFileTable($insert_filename, $filesize, $new_datepath, $username, $classid, $no, $type, $filepass, $filepass, $public_r[fpath], 0, $modtype, $fstb); //FileServer if ($public_r['openfileserver']) { $efileftp_fr[] = $insert_file; } } echo "<script>opener.ReloadChangeFilePage();window.close();</script>"; db_close(); exit; }
function Moreport_ChangeData($portr, $ecms = 0) { global $empire, $dbtbpre, $public_r, $ecms_config; $ecms_config['sets']['deftempid'] = $portr['tempgid']; if ($ecms == 1) { GetPlTempPage(); //评论列表模板 GetPlJsPage(); //评论JS模板 ReCptemp(); //控制面板模板 GetSearch(); //三搜索表单模板 GetPrintPage(); //打印模板 GetDownloadPage(); //下载地址页面 ReGbooktemp(); //留言板模板 ReLoginIframe(); //登陆状态模板 ReSchAlltemp(); //全站搜索模板 //防采集缓存 $yfile = ECMS_PATH . DASHBOARD . '/data/dbcache/notcj.php'; $nfile = ECMS_SELFPATH . DASHBOARD . '/data/dbcache/notcj.php'; @copy($yfile, $nfile); } elseif ($ecms == 2) { //临时文件目录 $tmppath = ECMS_SELFPATH . DASHBOARD . '/data/tmp'; $hand = @opendir($tmppath); while ($file = @readdir($hand)) { if ($file == '.' || $file == '..' || $file == 'test.txt' || $file == 'index.html' || $file == 'mod' || $file == 'temp' || $file == 'titlepic' || $file == 'cj') { continue; } $filename = $tmppath . '/' . $file; if (!is_dir($filename)) { DelFiletext($filename); } } } elseif ($ecms == 3) { $ypath = ECMS_PATH . 'd/js'; $npath = ECMS_SELFPATH . 'd/js'; CopyPath($ypath, $npath); $ypath = ECMS_PATH . DASHBOARD . '/data/fc'; $npath = ECMS_SELFPATH . DASHBOARD . '/data/fc'; CopyPath($ypath, $npath); $ypath = ECMS_PATH . DASHBOARD . '/data/html'; $npath = ECMS_SELFPATH . DASHBOARD . '/data/html'; CopyPath($ypath, $npath); $ypath = ECMS_PATH . DASHBOARD . '/data/template'; $npath = ECMS_SELFPATH . DASHBOARD . '/data/template'; CopyPath($ypath, $npath); } elseif ($ecms == 4) { if ($portr['mustdt'] || $public_r['indexpagedt']) { DelFiletext(ECMS_SELFPATH . 'index' . $public_r['indextype']); @copy(ECMS_SELFPATH . DASHBOARD . '/data/template/dtindexpage.txt', ECMS_SELFPATH . 'index.php'); } } else { //更新参数设置 GetConfig(1); //更新类别 GetClass(); //更新会员组 GetMemberLevel(); //更新全站搜索数据表 GetSearchAllTb(); } }
function DelUserjs($jsid, $userid, $username) { global $empire, $dbtbpre; $jsid = (int) $jsid; if (!$jsid) { printerror("NotChangeUserjsid", "history.go(-1)"); } //验证权限 CheckLevel($userid, $username, $classid, "userjs"); $r = $empire->fetch1("select jsname,jsfilename from {$dbtbpre}enewsuserjs where jsid={$jsid}"); $sql = $empire->query("delete from {$dbtbpre}enewsuserjs where jsid={$jsid}"); //删除文件 DelFiletext("../" . $r['jsfilename']); if ($sql) { //操作日志 insert_dolog("jsid={$jsid}&jsname={$r['jsname']}"); printerror("DelUserjsSuccess", "ListUserjs.php"); } else { printerror("DbError", "history.go(-1)"); } }
function DelSpReFile($file) { $filename = ECMS_PATH . $file; if ($file && file_exists($filename) && !stristr('/' . $file, '/e/')) { DelFiletext($filename); } }