function ondocsave() { include_once admin_ROOT . adminfile . '/include/inc_formtypelist.php'; include_once admin_ROOT . 'public/class_gather.php'; include_once admin_ROOT . 'public/class_downloadimages.php'; $inputclass = $this->fun->accept('inputclass', 'P'); $lng = $this->fun->accept('lng', 'P'); $mid = intval($this->fun->accept('mid', 'P')); $mid = empty($mid) ? 0 : $mid; $tid = intval($this->fun->accept('tid', 'P')); $tid = empty($tid) ? 0 : $tid; if (empty($tid)) { exit($this->lng['article_js_tid_empty']); } $tsn = $this->fun->accept('tsn', 'P'); $color = $this->fun->accept('color', 'P'); if ($color == $this->CON['input_color']) { $color = ''; } $tags = $this->fun->accept('tags', 'P'); $headtitle = $this->fun->accept('headtitle', 'P'); $keywords = $this->fun->accept('keywords', 'P'); $description = $this->fun->accept('description', 'P'); $recommend = $this->fun->accept('recommend', 'P'); if (!empty($recommend)) { $recommend = implode(',', $recommend); } $extid = $this->fun->accept('extid', 'P'); $extid = is_array($extid) ? implode(',', $extid) : 0; $sid = intval($this->fun->accept('sid', 'P')); $sid = empty($sid) ? 0 : $sid; $fgid = intval($this->fun->accept('fgid', 'P')); $fgid = empty($fgid) ? 0 : $fgid; $purview = intval($this->fun->accept('purview', 'P')); $purview = empty($purview) ? 0 : $purview; $click = intval($this->fun->accept('click', 'P')); $click = empty($click) ? 0 : $click; $addtime = $this->fun->accept('addtime', 'P'); $time = time(); $addtime = empty($addtime) ? $time : strtotime($addtime); $islink = $this->fun->accept('islink', 'P'); $islink = empty($islink) ? 0 : $islink; $link = $this->fun->accept('link', 'P'); $ishtml = intval($this->fun->accept('ishtml', 'P')); $ishtml = empty($ishtml) ? 0 : $ishtml; $isorder = intval($this->fun->accept('isorder', 'P')); $isorder = empty($isorder) ? 0 : $isorder; $istemplates = $this->fun->accept('istemplates', 'P'); $istemplates = empty($istemplates) ? 0 : $istemplates; $template = $this->fun->accept('template', 'P'); $filename = $this->fun->accept('filename', 'P'); $ismessage = intval($this->fun->accept('ismessage', 'P')); $ismessage = empty($ismessage) ? 0 : $ismessage; $albumlist = $this->fun->accept('albumlist', 'P'); $picname = $this->fun->accept('picname', 'P'); $filedes = $this->fun->accept('filedes', 'P'); $linkdid = $this->fun->accept('linkdid', 'P'); $donwloadpic = $this->fun->accept('donwloadpic', 'P'); $donwloadpic = empty($donwloadpic) ? 0 : $donwloadpic; $modelatt = $this->get_modelattArray($mid); $modelarray = array(); $modelsysarray = array(); foreach ($modelatt as $key => $value) { if ($value['inputtype'] == 'htmltext') { $value['accept'] = 'html'; } elseif ($value['inputtype'] == 'checkbox') { $value['accept'] = 'checkbox'; } elseif ($value['inputtype'] == 'string' || $value['inputtype'] == 'img' || $value['inputtype'] == 'addon' || $value['inputtype'] == 'video' || $value['inputtype'] == 'select' || $value['inputtype'] == 'radio' || $value['inputtype'] == 'selectinput') { $value['accept'] = 'text'; } elseif ($value['inputtype'] == 'editor' || $value['inputtype'] == 'text') { $value['accept'] = 'editor'; } elseif ($value['inputtype'] == 'int' || $value['inputtype'] == 'float' || $value['inputtype'] == 'decimal') { $value['accept'] = 'int'; } elseif ($value['inputtype'] == 'datetime') { $value['accept'] = 'data'; } if (!$value['lockin'] && !$value['issys']) { $modelarray[] = $value; } else { $modelsysarray[] = $value; } } $sysinstall = null; $sysinstalldb = null; $conent = null; foreach ($modelsysarray as $key => $value) { if ($value['attrname'] == 'content') { continue; } if ($inputclass == 'add') { $sysinstall .= $value['attrname'] . ','; if ($value['accept'] == 'int') { $valuestr = $this->fun->accept($value['attrname'], 'P'); $valuestr = empty($valuestr) ? 0 : $valuestr; $sysinstalldb .= "{$valuestr},"; } elseif ($value['accept'] == 'html') { $valuestr = $this->fun->accept($value['attrname'], 'P'); $valuestr = empty($valuestr) ? '' : $this->fun->Text2Html($valuestr); $sysinstalldb .= "'{$valuestr}',"; } elseif ($value['accept'] == 'editor' || $value['accept'] == 'text') { $valuestr = $this->fun->accept($value['attrname'], 'P'); $sysinstalldb .= "'{$valuestr}',"; } elseif ($value['accept'] == 'data') { $valuestr = $this->fun->accept($value['attrname'], 'P'); $valuestr = empty($valuestr) ? 0 : strtotime($valuestr); $sysinstalldb .= "{$valuestr},"; } } else { if ($value['accept'] == 'int') { $valuestr = $this->fun->accept($value['attrname'], 'P'); $valuestr = empty($valuestr) ? 0 : $valuestr; $sysinstalldb .= $value['attrname'] . "={$valuestr},"; } elseif ($value['accept'] == 'html') { $valuestr = $this->fun->accept($value['attrname'], 'P'); $valuestr = empty($valuestr) ? '' : $this->fun->Text2Html($valuestr); $sysinstalldb .= $value['attrname'] . "='{$valuestr}',"; } elseif ($value['accept'] == 'editor' || $value['accept'] == 'text') { $valuestr = $this->fun->accept($value['attrname'], 'P'); $sysinstalldb .= $value['attrname'] . "='{$valuestr}',"; } elseif ($value['accept'] == 'data') { $valuestr = $this->fun->accept($value['attrname'], 'P'); $valuestr = empty($valuestr) ? 0 : strtotime($valuestr); $sysinstalldb .= $value['attrname'] . "={$valuestr},"; } } } $userinstall = null; $userinstalldb = null; foreach ($modelarray as $key => $value) { $userinstall .= $value['attrname'] . ','; if ($value['accept'] == 'int') { $valuestr = $this->fun->accept($value['attrname'], 'P'); $valuestr = empty($valuestr) ? 0 : $valuestr; $userinstalldb .= "{$valuestr},"; $userupdatedb .= $value['attrname'] . "={$valuestr},"; } elseif ($value['accept'] == 'html') { $valuestr = $this->fun->accept($value['attrname'], 'P'); $valuestr = empty($valuestr) ? '' : $this->fun->Text2Html($valuestr); $userinstalldb .= "'{$valuestr}',"; $userupdatedb .= $value['attrname'] . "='{$valuestr}',"; } elseif ($value['accept'] == 'editor' || $value['accept'] == 'text') { $valuestr = $this->fun->accept($value['attrname'], 'P'); $userinstalldb .= "'{$valuestr}',"; $userupdatedb .= $value['attrname'] . "='{$valuestr}',"; } elseif ($value['accept'] == 'data') { $valuestr = $this->fun->accept($value['attrname'], 'P'); $valuestr = empty($valuestr) ? 0 : strtotime($valuestr); $userinstalldb .= "{$valuestr},"; $userupdatedb .= $value['attrname'] . "={$valuestr},"; } elseif ($value['accept'] == 'checkbox') { $valuestr = $this->fun->accept($value['attrname'], 'P'); $valuestr = is_array($valuestr) ? implode(',', $valuestr) : ''; $userinstalldb .= "'{$valuestr}',"; $userupdatedb .= $value['attrname'] . "='{$valuestr}',"; } } $is_keylink = $this->CON['is_keylink']; $is_html = $this->CON['is_html']; $file_htmldir = $this->CON['file_htmldir']; $content = $this->fun->accept('content', 'P'); if ($donwloadpic && !empty($content)) { $gather = new gather(); $temp_pic_content = $this->fun->stripslashes($content); $temp_pic_content = html_entity_decode($temp_pic_content); $images = $gather->imageList($temp_pic_content); if (is_array($images) && count($images) > 0 && !empty($images[0]) && !$this->fun->gb_check($images[0])) { $picsaveDIR = admin_ROOT . $this->CON['upfile_dir']; $showpictrue = true; foreach ($images as $key => $value) { if (empty($value)) { continue; } else { $picpathinfo = parse_url($value); $savepathinfo = parse_url(admin_URL); if ($picpathinfo['host'] == $savepathinfo['host'] || empty($picpathinfo['host'])) { continue; } } $Gimg = new GetImage(); $Gimg->source = $images[$key]; $Gimg->save_to = $picsaveDIR; $Gimg->smalltype = false; $Gfilename = $Gimg->download(); $temp_pic_content = str_replace($images[$key], admin_URL . $this->CON['upfile_dir'] . $Gfilename['filepath'] . $Gfilename['filename'], $temp_pic_content); } $content = addslashes($temp_pic_content); $content = htmlspecialchars($content); } } if (!empty($content)) { $input_isdellink = $this->fun->accept('input_isdellink', 'P'); if ($input_isdellink == 1) { $content = $this->fun->linkclear($content); } if ($is_keylink == 1 && !empty($tags)) { $content = $this->rep_keylink($content, $tags, $lng); } } $input_iskey = $this->CON['input_iskey']; $input_isdes = $this->CON['input_isdes']; $input_isdescription = $this->CON['input_isdescription']; $input_isdescription = empty($input_isdescription) ? 200 : $input_isdescription > 200 ? 200 : $input_isdescription; $input_iskeyword = $this->CON['input_iskeyword']; $input_iskeyword = empty($input_iskeyword) ? 10 : $input_iskeyword > 10 ? 10 : $input_iskeyword; $typeview = $this->get_type($tid); $type_styleid = $typeview['styleid']; $read_templates = $istemplates ? $template : $typeview['readtemplate']; $filenamestyle = $typeview['filenamestyle']; $readnamestyle = $typeview['readnamestyle']; $dirname = $typeview['dirname']; $dirpath = empty($typeview['dirpath']) ? $typeview['dirname'] : $typeview['dirpath'] . '/' . $typeview['dirname']; $aid = $this->esp_adminuserid; $isclass = $this->esp_inputclassid; $isclass = empty($isclass) ? 0 : $isclass; $db_table = db_prefix . 'document'; $db_table1 = db_prefix . 'document_content'; $db_table2 = db_prefix . 'document_attr'; if ($inputclass == 'add') { if (empty($description) && $input_isdescription > 0 && $input_isdes == 1 && !empty($content)) { $description = $this->fun->get_substr($content, 500, true); $description = $this->fun->daddslashes($description, 1); } if (empty($keywords) && $input_iskeyword > 0 && $input_iskey == 1 && !empty($content)) { $keywords = $this->get_keyword($content, $input_iskeyword); $keywords = $this->fun->daddslashes($keywords, 1); } $db_field = $sysinstall . 'lng,pid,mid,aid,tid,extid,sid,fgid,linkdid,isclass,islink,ishtml,ismess,isorder,ktid,purview,istemplates ,isbase,recommend,tsn,color,tags,keywords,description,link,click,addtime,uptime,template,filename,headtitle'; $db_values = $sysinstalldb . "'{$lng}',50,{$mid},{$aid},{$tid},'{$extid}',{$sid},{$fgid},'{$linkdid}',{$isclass},{$islink},{$ishtml},{$ismessage},{$isorder},0,{$purview},{$istemplates},\n\t\t\t\t0,'{$recommend}','{$tsn}','{$color}','{$tags}','{$keywords}','{$description}','{$link}',{$click},{$addtime},{$time},'{$read_templates}','{$filename}','{$headtitle}'"; $this->db->query('INSERT INTO ' . $db_table . ' (' . $db_field . ') VALUES (' . $db_values . ')'); $insert_id = $this->db->insert_id(); if (!empty($content)) { $db_field = 'did,content'; $db_values = "{$insert_id},'{$content}'"; $this->db->query('INSERT INTO ' . $db_table1 . ' (' . $db_field . ') VALUES (' . $db_values . ')'); } if ($userinstall && $userinstalldb) { $db_field = $userinstall . 'did'; $db_values = $userinstalldb . $insert_id; $this->db->query('INSERT INTO ' . $db_table2 . ' (' . $db_field . ') VALUES (' . $db_values . ')'); } if (!empty($albumlist)) { $this->install_pic($insert_id, $albumlist, $picname, $filedes, false); } $htmlid = $this->articlehtml($insert_id); $this->writelog($this->lng['article_add_log'], $this->lng['log_extra_ok'] . ' id=' . $insert_id); if ($htmlid['c'] == 1) { $returmess = $this->lng['article_js_doc_add_html_err2'] . '(' . $htmlid['s'] . ')'; exit($returmess); } elseif ($htmlid['c'] == 2) { $returmess = $this->lng['filedircreat_err'] . '(' . $htmlid['s'] . ')'; exit($returmess); } elseif ($htmlid['c'] == 3) { $returmess = $this->lng['filedir_err'] . '(' . $htmlid['s'] . ')'; exit($returmess); } elseif ($htmlid['c'] == 4) { $returmess = $this->lng['article_js_doc_add_html_err'] . '(' . $htmlid['s'] . ')'; exit($returmess); } elseif ($htmlid['c'] == 0) { exit('true'); } } elseif ($inputclass == 'edit') { $did = intval($this->fun->accept('did', 'P')); $datid = $this->fun->accept('datid', 'P'); $dcid = $this->fun->accept('dcid', 'P'); $isbase = intval($this->fun->accept('isbase', 'P')); $isbase = empty($isbase) ? 0 : $isbase; if (empty($did)) { exit($this->lng['article_js_doc_add_html_err3']); } $entrance_file = empty($this->CON['entrance_file']) ? 'index' : $this->CON['entrance_file']; $filepath = $this->fun->accept('filepath', 'P'); if ($ishtml == 1 && $is_html == 1 && $islink == 0) { $readfileArray = array('dirname' => $dirname, 'tid' => $tid, 'did' => $did, 'datetime' => date("YmdHis"), 'data' => date("Ymd"), 'y' => date("Y"), 'm' => date("m"), 'd' => date("d")); if ($isbase) { $filename = $entrance_file; } else { $filename = empty($filename) ? $this->get_htmlfilename($readnamestyle, $readfileArray) : $filename; } $filepath = empty($filepath) ? $dirpath : $filepath; } if (!empty($description) && $input_isdescription > 0) { $description = $this->fun->get_substr($description, 500, true); $description = $this->fun->daddslashes($description, 1); } $db_where = 'did=' . $did; $db_set = $sysinstalldb . "aid={$aid},tid={$tid},extid='{$extid}',sid={$sid},fgid={$fgid},linkdid='{$linkdid}',islink={$islink},ishtml={$ishtml},ismess={$ismessage},isorder={$isorder},purview={$purview},istemplates={$istemplates}\n\t\t\t\t,recommend='{$recommend}',tsn='{$tsn}',color='{$color}',tags='{$tags}',keywords='{$keywords}',description='{$description}',link='{$link}',click={$click},addtime={$addtime},uptime={$time},template='{$read_templates}',filename='{$filename}',filepath='{$filepath}',headtitle='{$headtitle}'"; $this->db->query('UPDATE ' . $db_table . ' SET ' . $db_set . ' WHERE ' . $db_where); if (!empty($content)) { if ($dcid) { $db_where = 'did=' . $did . ' AND dcid=' . $dcid; $db_set = "content='{$content}'"; $this->db->query('UPDATE ' . $db_table1 . ' SET ' . $db_set . ' WHERE ' . $db_where); } else { $db_field = 'did,content'; $db_values = "{$did},'{$content}'"; $this->db->query('INSERT INTO ' . $db_table1 . ' (' . $db_field . ') VALUES (' . $db_values . ')'); } } if ($userinstalldb) { if ($datid) { $db_where = 'did=' . $did . ' AND datid=' . $datid; $db_values = substr($userupdatedb, 0, strlen($userupdatedb) - 1); $this->db->query('UPDATE ' . $db_table2 . ' SET ' . $db_values . ' WHERE ' . $db_where); } else { $db_field = $userinstall . 'did'; $db_values = $userinstalldb . $did; $this->db->query('INSERT INTO ' . $db_table2 . ' (' . $db_field . ') VALUES (' . $db_values . ')'); } } $this->install_pic($did, $albumlist, $picname, $filedes); $htmlid = $this->articlehtml($did); $this->dbcache->clearcache('document_' . $did, true); $this->writelog($this->lng['article_edit_log'], $this->lng['log_extra_ok'] . ' id=' . $did); if ($htmlid['c'] == 1) { $returmess = $this->lng['article_js_doc_add_html_err2'] . '(' . $htmlid['s'] . ')'; exit($returmess); } elseif ($htmlid['c'] == 2) { $returmess = $this->lng['filedircreat_err'] . '(' . $htmlid['s'] . ')'; exit($returmess); } elseif ($htmlid['c'] == 3) { $returmess = $this->lng['filedir_err'] . '(' . $htmlid['s'] . ')'; exit($returmess); } elseif ($htmlid['c'] == 4) { $returmess = $this->lng['article_js_doc_add_html_err'] . '(' . $htmlid['s'] . ')'; exit($returmess); } elseif ($htmlid['c'] == 0) { exit('true'); } } }
<?php session_start(); if ($_SESSION['login'] != 1) { exit; } error_reporting(E_ERROR); set_time_limit(180); include 'include/init.php'; include 'gather.php'; $gather = new gather(); $now = time(); $list = $database->select('gether_info', array('id', 'remote_page_name'), array('is_read' => 0)); if ($list) { foreach ($list as $value) { $url = 'http://www.cswanda.com/weixin/game1/' . $value['remote_page_name']; $furl = $gather->getFuckUrl($url); if ($furl['fuckurl']) { $last_user_id = $database->insert("video_info", array("vid" => $value['id'], "frame_url" => $furl['fuckurl'][1][0], 'add_time' => $now)); if ($last_user_id) { $database->update('gether_info', array('is_read' => 1), array('id' => $value['id'])); echo $value['id'] . '已成功提取' . $furl['fuckurl'][1][0] . '</br>'; } } if ($furl['part'] && $value['pid'] == 0) { for ($i = 0; $i < count($furl['part'][0]); $i++) { $last_insert_id = $database->insert("gether_info", array("remote_page_name" => substr($value['remote_page_name'], 0, strrpos($value['remote_page_name'], '/') + 1) . ltrim(ltrim($furl['part'][1][$i], '.'), '/'), "pid" => $value['id'], "title" => $furl['part'][2][$i], 'add_time' => $now)); if ($last_insert_id) { echo $value['id'] . '成功添加分集' . $furl['part'][2][$i] . '请稍后再次提取</br>'; } }
$this->sql($data); } // exit(); } } //-------------end儿童读物------------ function run() { $url_c = array('http://list.dangdang.com/book/01.41.05_Z25.html', 'http://list.dangdang.com/book/01.41.41_Z25.html', 'http://list.dangdang.com/book/01.41.43_Z25.html', 'http://list.dangdang.com/book/01.41.45_Z25.html', 'http://list.dangdang.com/book/01.41.48_Z25.html', 'http://list.dangdang.com/book/01.41.59_Z40.html', 'http://list.dangdang.com/book/01.41.55_Z25.html'); $url_ch = array('http://book.dangdang.com/children/01.41.26.htm', 'http://book.dangdang.com/children/01.41.27.htm', 'http://book.dangdang.com/children/01.41.44.htm', 'http://book.dangdang.com/children/01.41.46.htm', 'http://book.dangdang.com/children/01.41.50.htm', 'http://book.dangdang.com/children/01.41.51.htm'); $url = array('http://book.dangdang.com/children/children.aspx?ref=book-01-A'); // $url="http://product.dangdang.com/product.aspx?product_id=20915489&ref=book-02-M"; // $content=$this->resolution($url); // @$this->data_data($content,$url); $t = 89; for ($i = 5; $i < 6; $i++) { $url = $url_ch[$i]; $content = $this->resolution($url); $t = $this->get_url($content, $t); } echo "ok"; // $content=$this->resolution("http://list.dangdang.com/book/01.21.20.htm"); // @$this->data_url($content); } } ini_set('max_execution_time', '360000000*28'); $cai = new gather(); $cai->run(); ?>
<?php error_reporting(E_ERROR); set_time_limit(180); include 'include/init.php'; include 'gather.php'; $gather = new gather(); $now = time(); $data = $gather->getIndexList(); foreach ($data as $value) { preg_match_all('/href="\\.([^"|\']+)".*data-echo="([^"|\'].+)".+\\n.+.+sNum">(.+)\\n.+emHot">(.+)<\\/em>.+sTit">(.+)<\\/span>/Ui', $value, $matches); if (!empty($matches)) { $category = $database->get('gether_info', 'part', array("remote_page_name" => $matches[1][0])); if (!$category) { $last_user_id = $database->update("gether_info", array("part" => $matches[3][0]), array("remote_page_name" => $matches[1][0])); } if ($last_user_id) { echo '成功更新类型' . $matches[3][0] . '</br>'; } } } if (empty($last_user_id)) { echo '数据库为最新列表'; }