In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
How does Imperial CMS6.0 function decryption implement field processing function? In view of this problem, this article introduces the corresponding analysis and answers in detail, hoping to help more partners who want to solve this problem to find a more simple and feasible way.
Foreword:
When adding / modifying fields, you can set "background add information processing function", "background modify information processing function", "foreground add information processing function", "foreground modify information processing function". You can set the functions for dealing with the content of the field, and you can use more models that have special requirements for the storage format of the field content. Today we will briefly explain the format of the processing function.
Basic setup steps:
1. Write processing functions
2. Copy the function to the content of e/class/userfun.php file
3. Modify the name of the field setting processing function.
Field processing function format:
Function user_FieldFun ($mid,$f,$isadd,$isq,$value,$cs) {return $value;}
Parameter description:
User_FieldFun: function name
$mid: system model ID
$f: field name
$isadd: a value of 1 means adding information; a value of 0 means modifying information
$isq: background processing when the value is 0; foreground processing when the value is 1
$value: original content of the field
$cs: the parameter is added to the field, and the parameter content set at the field processing function
Example of field handling functions:
Example 1: automatically add the word "[EmpireCMS]" to the title
Background field function setting: user_AddTitle
Function user_AddTitle ($mid,$f,$isadd,$isq,$value,$cs) {$value=' [EmpireCMS]'.$ value; return $value;}
Example 2: the title content consists of a combination of writer and befrom fields
Background field function setting: user_TogTitle
The title field displays the HTML code:
(note: because the title is required, it is necessary to give the initial value so that the content is not prompted to be empty)
Function user_TogTitle ($mid,$f,$isadd,$isq,$value,$cs) {$value=$_POST ['writer']. $_ POST [' befrom']; return $value;}
Example 3: upload pictures and automatically generate thumbnails
Background field function setting: user_TranImgAuto##170120
(note: parameter 170 in the background indicates the width of the thumbnail and 120 is the height of the thumbnail)
The upload image field displays the HTML code:
(note: the variable name uses "field name" + imgrs, which corresponds to the "$filetf" variable in the function)
Function user_TranImgAuto ($mid,$f,$isadd,$isq,$value,$cs) {global $empire,$dbtbpre,$public_r,$emod_r,$class_r,$tranpicturetype,$musername; $filetf=$f.'imgrs';// variable name if (! $_ FILES [$filetf] ['name']) {return $value;} $classid= (int) $_ POST [' classid']; $id= (int) $_ POST ['id'] $filepass= (int) $_ POST ['filepass']; $filetype=GetFiletype ($_ FILES [$filetf] [' name']); $pr=$empire- > fetch2 ("select qaddtran,qaddtransize,qaddtranimgtype from {$dbtbpre} enewspublic limit 1"); if (! $pr ['qaddtran']) {printerror ("CloseQTranPic", "", 1) } if (! strstr ($pr ['qaddtranimgtype'], "| |. $filetype." | ") {printerror (" NotQTranFiletype ",", 1);} if ($_ FILES [$filetf] [' size'] > $pr ['qaddtransize'] * 1024) {printerror ("TooBigQTranFile", "", 1) } if (! strstr ($tranpicturetype,','.$filetype.',')) {printerror ("NotQTranFiletype", "", 1);} $tfr=DoTranFile ($_ FILES [$filetf] ['tmp_name'], $_ FILES [$filetf] [' name'], $_ FILES [$filetf] ['type'], $_ FILES [$filetf] [' size'], $classid) If ($tfr ['tran']) {$csr=explode (',', $cs); $maxwidth=$csr [0]; $maxheight=$csr [1]; $yname=$tfr ['yname']; $name=$tfr [' name']; include_once (ECMS_PATH.'e/class/gd.php') / / generate thumbnails $filer=ResizeImage ($yname,$name,$maxwidth,$maxheight,$public_r ['spickill']); DelFiletext ($yname); if ($filer [' file']) {/ / write to database $type=1 $filetime=date ("Y-m-d H:i:s"); $filesize=@filesize ($filer ['file']); $filename=GetFilename (str_replace (ECMS_PATH,'',$filer [' file'])); $adduser=' [Member]'. $musername; $infoid=$isadd==1?0:$id $empire- > query ("insert into {$dbtbpre} enewsfile (filename,filesize,adduser,path,filetime,classid,no,type,id,cjid,fpath) values ('$filename','$filesize','$adduser','$ TF [filepath]','$filetime','$classid',' [". $f. "]" .addslink (RepPostStr ($_ post [title])). ",'$type','$infoid','$filepass','$public_ r [Fpath]');") If ($isadd==0) {$tbname=$emod_r [$mid] ['tbname'] If (strstr ($emod_r [$mid] ['tbdataf'],','. $f.)) {$ir=$empire- > fetch2 ("select stb from {$dbtbpre} ecms_". $tbname. " Where id='$id' "); $ifr=$empire- > fetch2 (" select ". $f." From {$dbtbpre} ecms_ ". $tbname." _ data_ ". $ir [STB]." Where id='$id' "); $ifval=$ifr [$f];} else {$ir=$empire- > fetch2 (" select ". $f." From {$dbtbpre} ecms_ ". $tbname." Where id='$id' "); $ifval=$ir [$f];} if ($ifval) {DelYQTranFile ($classid,$id,$ifval,$f) } $value=str_replace ($tfr ['filename'], $filename,$tfr [' url']);}} else {$value='';} return $value;}
Processing functions can achieve a lot of very complex field content storage format requirements, the above are just a few simple examples, more users need to practice.
This is the answer to the question about how to decrypt the Imperial CMS6.0 function. I hope the above content can be of some help to you. If you still have a lot of doubts to be solved, you can follow the industry information channel to learn more about it.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.