function doCrop() { $pFile = $_GET['pic']; $iFile = uploadpath($pFile, '+iPATH'); $callback = $_GET['callback']; list($width, $height, $imagetype) = @getimagesize($iFile); $pw = $width > 500 ? 500 : $width; $tw = (int) $this->iCMS->config['thumbwidth']; $th = (int) $this->iCMS->config['thumbhight']; $rate = round($pw / $width, 2) * 100; $sliderMin = round($tw / $width, 2) * 100; include admincp::tpl(); }
function gethumb($sfp, $w = '', $h = '', $tdir = false, $scale = true, $callback = false) { global $iCMS; if (strpos($sfp, 'thumb/') !== false) { return $sfp; } $info = pathinfo($sfp); $tpf = $info['dirname'] . '/thumb/' . $info['filename'] . '_'; if ($callback) { $rootpf = uploadpath($tpf, '+iPATH'); $tfArray = glob($rootpf . "*"); if ($tfArray) { foreach ($tfArray as $_tfp) { if (file_exists($_tfp)) { $fn = substr($_tfp, 0, strrpos($_tfp, '.')); $per = substr($fn, strrpos($fn, '_') + 1); $tfpList[$per] = uploadpath($_tfp, '-iPATH'); } } } return $tfpList; } else { $srfp = uploadpath($sfp, 'http2iPATH'); $tdir && ($tpf = $tdir . '/' . $info['filename'] . '_'); $rootpf = uploadpath($tpf, 'http2iPATH'); if (file_exists($srfp)) { empty($w) && ($w = $iCMS->config['thumbwidth']); empty($h) && ($h = $iCMS->config['thumbhight']); $twh = $rootpf . $w . 'x' . $h . '.' . FS::getext($sfp); if (file_exists($twh)) { return uploadpath($twh, 'iPATH2http'); } else { if ($iCMS->config['issmall']) { require_once iPATH . 'include/upload.class.php'; $Thumb = iUpload::thumbnail(dirname($tdir ? $rootpf : $srfp) . '/', $srfp, $info['filename'], $w, $h, $scale, $tdir ? '' : 'thumb'); return uploadpath($Thumb['src'], 'iPATH2http'); } else { return $sfp; } } } else { return $iCMS->config['uploadURL'] . '/nopic.gif'; } } }
function delArticle($id, $uid = '-1', $postype = '1') { global $iCMS; $sql = $uid != "-1" ? "and `userid`='{$uid}' and `postype`='{$postype}'" : ""; $id = (int) $id; $art = iCMS_DB::getRow("SELECT * FROM `#iCMS@__article` WHERE id='{$id}' {$sql} Limit 1"); if ($art->pic) { $usePic = iCMS_DB::getValue("SELECT id FROM `#iCMS@__article` WHERE `pic`='{$art->pic}' and `id`<>'{$id}'"); if (empty($usePic)) { $thumbfilepath = gethumb($art->pic, '', '', false, true, true); FS::del(uploadpath($art->pic, '+iPATH')); $msg .= $art->pic . ' 文件删除…<span style=\'color:green;\'>√</span><br />'; if ($thumbfilepath) { foreach ($thumbfilepath as $wh => $fp) { FS::del(uploadpath($fp, '+iPATH')); $msg .= '缩略图 ' . $wh . ' 文件删除…<span style=\'color:green;\'>√</span><br />'; } } $filename = FS::info($art->pic)->filename; iCMS_DB::query("DELETE FROM `#iCMS@__file` WHERE `filename` = '{$filename}'"); $msg .= $art->pic . ' 数据删除…<span style=\'color:green;\'>√</span><br />'; } else { $msg .= $art->pic . '文件 其它文章正在使用,请到文件管理删除…<span style=\'color:green;\'>×</span><br />'; } } $forum = $iCMS->getCache('system/forum.cache', $art->fid); $body = iCMS_DB::getValue("SELECT `body` FROM `#iCMS@__article_data` WHERE aid='{$id}' Limit 1"); if ($forum['mode'] && strstr($forum['contentRule'], '{PHP}') === false && empty($art->url)) { $bArray = explode('<!--iCMS.PageBreak-->', $body); $total = count($bArray); for ($i = 1; $i <= $total; $i++) { $iurl = $iCMS->iurl('show', array((array) $art, $forum), $i); FS::del($iurl->path); $msg .= $iurl->path . ' 静态文件删除…<span style=\'color:green;\'>√</span><br />'; } } $frs = iCMS_DB::getArray("SELECT `filename`,`path`,`ext` FROM `#iCMS@__file` WHERE `aid`='{$id}'"); for ($i = 0; $i < count($frs); $i++) { if (!empty($frs[$i])) { $path = $frs[$i]['path'] . '/' . $frs[$i]['filename'] . '.' . $frs[$i]['ext']; FS::del(uploadpath($frs[$i]['path'], '+iPATH')); $msg .= $path . ' 文件删除…<span style=\'color:green;\'>√</span><br />'; } } if ($art->tags) { $tagArray = explode(",", $art->tags); foreach ($tagArray as $k => $v) { if (iCMS_DB::getValue("SELECT `count` FROM `#iCMS@__tags` WHERE `name`='{$v}'") == "1") { iCMS_DB::query("DELETE FROM `#iCMS@__tags` WHERE `name`='{$v}'"); $iCMS->iCache->delete($iCMS->getTagKey($v)); } else { iCMS_DB::query("UPDATE `#iCMS@__tags` SET `count`=count-1 ,`updatetime`='" . time() . "' WHERE `name`='{$v}'"); } } iCMS_DB::query("DELETE FROM `#iCMS@__taglist` WHERE indexId='{$id}' AND modelId='0'"); $msg .= '标签更新…<span style=\'color:green;\'>√</span><br />'; } iCMS_DB::query("DELETE FROM `#iCMS@__file` WHERE `aid`='{$id}'"); $msg .= '相关文件数据删除…<span style=\'color:green;\'>√</span><br />'; iCMS_DB::query("DELETE FROM `#iCMS@__comment` WHERE indexId='{$id}' and mid='0'"); $msg .= '评论数据删除…<span style=\'color:green;\'>√</span><br />'; iCMS_DB::query("DELETE FROM `#iCMS@__article` WHERE id='{$id}'"); iCMS_DB::query("DELETE FROM `#iCMS@__article_data` WHERE `id`='{$id}'"); iCMS_DB::query("DELETE FROM `#iCMS@__vlink` WHERE indexId='{$id}' AND modelId='0'"); $msg .= '文章数据删除…<span style=\'color:green;\'>√</span><br />'; iCMS_DB::query("UPDATE `#iCMS@__forum` SET `count` = count-1 WHERE `fid` ='{$art->fid}' LIMIT 1"); $msg .= '栏目数据更新…<span style=\'color:green;\'>√</span><br />'; $msg .= '删除完成…<span style=\'color:green;\'>√</span><hr />'; return $msg; }
<th>ID</th> <th>文件名</th> <th>内容ID</th> <th>文件大小</th> <th>上传时间</th> <th>管理</th> </tr> </thead> <?php for ($i = 0; $i < $_count; $i++) { $filename = $rs[$i]['filename'] . '.' . $rs[$i]['ext']; $path = $rs[$i]['path'] . '/' . $filename; $rs[$i]['time'] = get_date($rs[$i]['time'], 'Y-m-d H:i'); $rs[$i]['size'] = FS::sizeUnit($rs[$i]['size']); $rs[$i]['icon'] = FS::icon($filename); $rs[$i]['path'] = uploadpath($path); ?> <tr id="fid<?php echo $rs[$i]['id']; ?> "> <td><input type="checkbox" class="checkbox" name="delete[]" value="<?php echo $rs[$i]['id']; ?> " /></td> <td><?php echo $total - ($i + $this->firstcount); ?> </td> <td><a href="<?php echo $rs[$i]['path'];
function insert_db_remote($content, $aid) { $content = stripslashes($content); preg_match_all("/<img.*?src\\s*=[\"|'|\\s]*((http|file):\\/\\/.*?\\.(gif|jpg|jpeg|bmp|png)).*?>/is", $content, $match); $_array = array_unique($match[1]); set_time_limit(0); foreach ($_array as $key => $value) { $value = uploadpath($value, '-http'); $filename = basename($value); $pic = iCMS_DB::getValue("SELECT `pic` FROM `#iCMS@__article` WHERE `id` = '{$aid}'"); $this->autopic && $key == 0 && empty($pic) && iCMS_DB::query("UPDATE `#iCMS@__article` SET `isPic`='1',`pic` = '{$value}' WHERE `id` = '{$aid}'"); $faid = iCMS_DB::getValue("SELECT `aid` FROM `#iCMS@__file` WHERE `filename` ='{$filename}'"); empty($faid) && iCMS_DB::query("UPDATE `#iCMS@__file` SET `aid` = '{$aid}' WHERE `filename` ='{$filename}'"); } }
public function Show($id, $page = 1, $tpl = true) { $rs = iCMS_DB::getRow("SELECT a.*,d.tpl,d.body,d.subtitle FROM #iCMS@__article as a LEFT JOIN #iCMS@__article_data AS d ON a.id = d.aid WHERE a.id='" . (int) $id . "' AND a.status ='1'"); //echo iCMS_DB::$last_query; //iCMS_DB::$last_query='explain '.iCMS_DB::$last_query; //$explain=iCMS_DB::getRow(iCMS_DB::$last_query); //var_dump($explain); empty($rs) && $this->error('error:page'); $F = $this->getCache('system/forum.cache', $rs->fid); if ($F['status'] == 0) { return false; } if ($rs->url) { if ($this->mode == "CreateHtml") { return false; } else { $this->go($rs->url); } } if ($this->mode == "CreateHtml" && (strstr($F['contentRule'], '{PHP}') || $F['url'] || $F['mode'] == 0)) { return false; } $_iurlArray = array((array) $rs, $F); $rs->iurl = $this->iurl('show', $_iurlArray, $page); $rs->url = $rs->iurl->href; $tpl && $this->gotohtml($rs->iurl->path, $rs->iurl->href, $F['mode']); $this->commentInfo = array('title' => $rs->title, 'indexId' => $rs->id, 'mId' => 0, 'sortId' => $rs->fid); $this->iList($rs->fid, false); preg_match_all("/<img.*?src\\s*=[\"|'|\\s]*(http:\\/\\/.*?\\.(gif|jpg|jpeg|bmp|png)).*?>/is", $rs->body, $picArray); $pA = array_unique($picArray[1]); foreach ($pA as $key => $pVal) { $ipVal = uploadpath($pVal, 'http2iPATH'); file_exists($ipVal) && ($rs->photo[] = trim($pVal)); } $body = explode('<!--iCMS.PageBreak-->', $rs->body); $rs->pagetotal = count($body); $rs->body = $this->keywords($body[intval($page - 1)]); $rs->pagecurrent = $page; if ($rs->pagetotal > 1) { $ppHref = $this->iurl('show', $_iurlArray, $page - 1 > 1 ? $page - 1 : 1)->href; $rs->pagebreak = '<a href="' . $ppHref . '" class="prevpagebreak" target="_self">' . $this->language('page:prev') . '</a> '; for ($i = 1; $i <= $rs->pagetotal; $i++) { $cls = $i == $page ? "pagebreaksel" : "pagebreak"; $rs->pagebreak .= '<a href="' . $this->iurl('show', $_iurlArray, $i)->href . '" class="' . $cls . '" target="_self">' . $i . '</a>'; } $npHref = $this->iurl('show', $_iurlArray, $rs->pagetotal - $page > 0 ? $page + 1 : $page)->href; $rs->pagebreak .= '<a href="' . $npHref . '" class="nextpagebreak" target="_self">' . $this->language('page:next') . '</a>'; if ($page < $rs->pagetotal) { $imgA = array_unique($picArray[0]); foreach ($imgA as $key => $img) { $rs->body = str_replace($img, '<p align="center"><a href="' . $npHref . '"><b>' . $this->language('show:PicGotoNext') . '</b></a></p> <a href="' . $npHref . '" title="' . $rs->title . '">' . $img . '</a><br/>', $rs->body); } } } $rs->page = array('total' => $rs->pagetotal, 'current' => $rs->pagecurrent, 'break' => $rs->pagebreak, 'prev' => $ppHref, 'next' => $npHref); if ($rs->tags) { $tagarray = explode(',', $rs->tags); foreach ($tagarray as $tk => $tag) { $t = $this->getTag($tag); if ($t) { $rs->tag[$tk]['name'] = $tag; $rs->tag[$tk]['url'] = $t['url']; $rs->taglink .= '<a href="' . $rs->tag[$tk]['url'] . '" class="tag" target="_self" title="' . $t['count'] . $this->language('page:list') . '">' . $rs->tag[$tk]['name'] . '</a> '; } } } $rs->rel = $rs->related; $rs->prev = $this->language('show:first'); $prers = iCMS_DB::getRow("SELECT * FROM `#iCMS@__article` WHERE `id` < '{$rs->id}' AND `fid`='{$rs->fid}' AND `status`='1' order by id DESC Limit 1"); $prers && ($rs->prev = '<a href="' . $this->iurl('show', array((array) $prers, $F))->href . '" class="prev" target="_self">' . $prers->title . '</a>'); $rs->next = $this->language('show:last'); $nextrs = iCMS_DB::getRow("SELECT * FROM `#iCMS@__article` WHERE `id` > '{$rs->id}' and `fid`='{$rs->fid}' AND `status`='1' order by id ASC Limit 1"); $nextrs && ($rs->next = '<a href="' . $this->iurl('show', array((array) $nextrs, $F))->href . '" class="next" target="_self">' . $nextrs->title . '</a>'); $rs->link = "<a href='{$rs->url}'>{$rs->title}</a>"; $this->result = $rs; if ($F['mode']) { $rs->hits = "<script src=\"" . $this->config['publicURL'] . "/action.php?do=hits&id={$rs->id}&action=show\" type=\"text/javascript\"></script>"; $rs->digg = "<script src=\"" . $this->config['publicURL'] . "/action.php?do=digg&id={$rs->id}&action=show\" type=\"text/javascript\"></script>"; $rs->comments = "<script src=\"" . $this->config['publicURL'] . "/action.php?do=comment&id={$rs->id}\" type=\"text/javascript\"></script>"; } else { $this->mode != 'CreateHtml' && iCMS_DB::query("UPDATE `#iCMS@__article` SET hits=hits+1 WHERE `id` ='{$rs->id}' LIMIT 1"); } $this->assign('show', (array) $rs); if ($tpl) { $tpl = empty($rs->tpl) ? $F['contentTPL'] : $rs->tpl; return $this->iPrint($tpl, 'show'); } }
高: <input type="text" id="h" name="h" value="0"/> <br /> </fieldset> <input type="submit" value="剪切" class="sbtn"/> </td> <td ><fieldset> <legend>预览</legend> <div style="width:<?php echo $tw; ?> px;height:<?php echo $th; ?> px;overflow:hidden; margin:5px;"> <img src="<?php echo uploadpath($pFile, '+http'); ?> " id="crop_preview" width="<?php echo $pw; ?> " style="border:#CCCCCC solid 1px;"/> </div> </fieldset></td> </tr> </form> </table></td> </tr> </table> </fieldset> </div> </body> </html>
function into($id) { $rs = iCMS_DB::getRow("SELECT a.title,ad.body FROM `#iCMS@__article` a LEFT JOIN `#iCMS@__article_data` ad ON a.id=ad.aid WHERE a.id='{$id}'"); $img = array(); $msg = false; preg_match_all("/<img.*?src\\s*=[\"|'|\\s]*(http:\\/\\/.*?\\.(gif|jpg|jpeg|bmp|png)).*?>/is", $rs->body, $img); $_array = array_unique($img[1]); foreach ($_array as $key => $value) { $value = uploadpath($value, '-http'); $rootpf = uploadpath($value, '+iPATH'); if (file_exists($rootpf)) { $pti = pathinfo($rootpf); $_FileSize = @filesize($rootpf); $filename = $pti['filename']; $frs = iCMS_DB::getRow("SELECT `id`,`aid` FROM `#iCMS@__file` WHERE `filename`='{$filename}'"); if (empty($frs)) { iCMS_DB::query("INSERT INTO `#iCMS@__file` (`aid`,`filename`,`ofilename`,`path`,`intro`,`ext`,`size` ,`time`,`type`) VALUES ('{$id}','" . $filename . "', '', '{$path}','{$rs->title}', '" . $pti['extension'] . "', '{$_FileSize}', '" . time() . "', '0')"); $msg .= "图片: " . $value . " 入库…<span style='color:green;'>√</span><br />"; } else { $msg .= "图片: " . $value . " 文件库中已有…<span style='color:green;'>×</span><br />"; } if (empty($frs->aid)) { iCMS_DB::query("UPDATE `#iCMS@__file` SET `aid`='{$id}' where `filename`='{$filename}'"); $msg .= "图片: " . $value . " 所属文章ID已更新…<span style='color:green;'>√</span><br />"; } } else { $data = "AID: " . $id . " 路径: [" . $rootpf . "] 标题: " . $rs->title . "\n"; FS::write(iPATH . "admin/logs/pic_exist_" . date('Y-m-d') . ".txt", $data, true, "a+"); } } return $msg; }
function iCMS_list($vars, &$iCMS) { if ($vars['loop'] == "rel" && empty($vars['id'])) { return false; } $whereSQL = " status='1'"; $_cache = $iCMS->getCache(array('system/forum.cache', 'system/forum.hidden')); $_cache['system/forum.hidden'] && ($whereSQL .= getSQL($_cache['system/forum.hidden'], 'fid', 'not')); $maxperpage = isset($vars['row']) ? (int) $vars['row'] : 10; $cacheTime = isset($vars['time']) ? (int) $vars['time'] : -1; isset($vars['userid']) && ($whereSQL .= " AND `userid`='{$vars['userid']}'"); isset($vars['author']) && ($whereSQL .= " AND `author`='{$vars['author']}'"); isset($vars['top']) && ($whereSQL .= " AND `top`='" . _int($vars['top']) . "'"); $vars['call'] == 'user' && ($whereSQL .= " AND `postype`='0'"); $vars['call'] == 'admin' && ($whereSQL .= " AND `postype`='1'"); $forum = $_cache['system/forum.cache']; if (isset($vars['fid!'])) { $_Nfid = getfids($vars['fid!']); $_Nfid && ($Nfids[] = $_Nfid); $vars['sub'] == 'all' && ($Nfids[] = $vars['fid!']); $ids = $Nfids && $vars['sub'] == 'all' ? implode(',', $Nfids) : $vars['fid!']; $whereSQL .= getSQL($ids, 'fid', 'not'); } if (isset($vars['fid'])) { $_fid = getfids($vars['fid']); $_fid && ($fids[] = $_fid); $vars['sub'] == 'all' && ($fids[] = $vars['fid']); $ids = $fids && $vars['sub'] == 'all' ? implode(',', $fids) : $vars['fid']; $whereSQL .= getSQL($ids, 'fid'); } isset($vars['type']) && ($whereSQL .= " AND `type` ='{$vars['type']}'"); $vars['id'] && ($whereSQL .= getSQL($vars['id'], 'id')); $vars['id!'] && ($whereSQL .= getSQL($vars['id!'], 'id', 'not')); $by = $vars['by'] == "ASC" ? "ASC" : "DESC"; if ($vars['keywords']) { if (strpos($vars['keywords'], ',') === false) { $vars['keywords'] = str_replace(array('%', '_'), array('\\%', '\\_'), $vars['keywords']); $whereSQL .= " AND CONCAT(title,keywords,description) like '%" . addslashes($vars['keywords']) . "%'"; } else { $kw = explode(',', $vars['keywords']); foreach ($kw as $v) { $keywords .= addslashes($v) . "|"; } $keywords = substr($keywords, 0, -1); $whereSQL .= " And CONCAT(title,keywords,description) REGEXP '{$keywords}' "; } } isset($vars['pic']) && ($whereSQL .= " AND `isPic`='1'"); switch ($vars['orderby']) { case "id": $orderSQL = " ORDER BY `id` {$by}"; break; case "hot": $orderSQL = " ORDER BY `hits` {$by}"; break; case "comment": $orderSQL = " ORDER BY `comments` {$by}"; break; case "pubdate": $orderSQL = " ORDER BY `pubdate` {$by}"; break; case "disorder": $orderSQL = " ORDER BY `orderNum` {$by}"; break; // case "rand": $orderSQL=" ORDER BY rand() $by"; break; // case "rand": $orderSQL=" ORDER BY rand() $by"; break; case "top": $orderSQL = " ORDER BY `top`,`orderNum` ASC"; break; default: $orderSQL = " ORDER BY `id` DESC"; } isset($vars['date']) && (list($iCMS->date['y'], $iCMS->date['m'], $iCMS->date['d']) = explode('-', $vars['date'])); if ($iCMS->date) { $day = empty($iCMS->date['d']) ? '01' : $iCMS->date['d']; $start = strtotime($iCMS->date['y'] . $iCMS->date['m'] . $day); $end = empty($iCMS->date['d']) ? $start + 86400 * $iCMS->date['total'] : $start + 86400; $whereSQL .= " AND `pubdate`<='{$end}' AND `pubdate`>='{$start}'"; } else { isset($vars['startdate']) && ($whereSQL .= " AND `pubdate`>='" . strtotime($vars['startdate']) . "'"); isset($vars['enddate']) && ($whereSQL .= " AND `pubdate`<='" . strtotime($vars['enddate']) . "'"); } isset($vars['where']) && ($whereSQL .= $vars['where']); if ($vars['action'] == 'search') { $whereSQL .= $iCMS->actionSQL; // }elseif($vars['action']=='vlink'){ // $this->countSQL = 'SELECT count(#iCMS@__article.id) FROM `#iCMS@__article`,`#iCMS@__vlink` WHERE #iCMS@__article.id = `indexId` AND `fid`=\''.$vars['fid'].'\' AND'; // $this->selectSQL= 'SELECT #iCMS@__article.* FROM `#iCMS@__article`,`#iCMS@__vlink` WHERE #iCMS@__article.id = `indexId` AND `fid`=\''.$vars['fid'].'\' AND'; // $orderSQL = " ORDER BY #iCMS@__vlink.indexId $by"; } elseif ($vars['action'] == 'tag') { if (empty($vars['tag'])) { return false; } if (is_array($vars['tag'])) { $_tCache = $vars['tag']; } else { $_tCache = $iCMS->getCache($iCMS->getTagKey($vars['tag'])); } if ($_tCache['id']) { $tidSQL = 'AND `tid`=\'' . $_tCache['id'] . '\''; } else { if ($_tCache) { foreach ($_tCache as $_tag) { if ($_tag) { $_tids[] = $_tag['id']; } } } if (empty($_tids)) { return false; } $tidSQL = 'AND `tid` in (' . implode(',', $_tids) . ')'; } $countSQL = 'SELECT count(#iCMS@__article.id) FROM `#iCMS@__article`,`#iCMS@__taglist` WHERE #iCMS@__article.id = `indexId` ' . $tidSQL . ' AND'; $selectSQL = 'SELECT #iCMS@__article.* FROM `#iCMS@__article`,`#iCMS@__taglist` WHERE #iCMS@__article.id = `indexId` ' . $tidSQL . ' AND'; $orderSQL = " ORDER BY #iCMS@__taglist.indexId {$by}"; $vars['indexId!'] && ($whereSQL .= getSQL($vars['indexId!'], '#iCMS@__article.id', 'not')); } $offset = 0; if ($vars['page']) { empty($countSQL) && ($countSQL = "SELECT count(*) FROM `#iCMS@__article` WHERE"); $total = iCMS_DB::getValue($countSQL . " {$whereSQL}"); // echo iCMS_DB::last_query; $pagenav = isset($vars['pagenav']) ? $vars['pagenav'] : "pagenav"; $pnstyle = isset($vars['pnstyle']) ? $vars['pnstyle'] : 0; $offset = $iCMS->multi(array('total' => $total, 'perpage' => $maxperpage, 'unit' => $iCMS->language('page:list'), 'url' => $iCMS->url, 'nowindex' => $GLOBALS['page'], 'pagenav' => $pagenav, 'pnstyle' => $pnstyle)); // $GLOBALS['cpn'] && $iCMS->_vars['pagenav'].='<span><a class="page_more" href="more.php?fid='.$ids.'" target="_self">'.$iCMS->language('page:more').'</a></span>'; //$iCMS->addto($pagenav,"----------------"); } $iscache = true; if ($vars['cache'] == false || isset($vars['page'])) { $iscache = false; $rs = ''; } else { $cacheName = 'list/' . md5($whereSQL . $orderSQL . $maxperpage); $rs = $iCMS->getCache($cacheName); } if (empty($rs)) { empty($selectSQL) && ($selectSQL = "SELECT id,fid,title,stitle,clink,url,source,author,editor,userid,pic,keywords,tags,description,related,pubdate,hits,good,bad,comments,top FROM `#iCMS@__article` WHERE"); $rs = iCMS_DB::getArray($selectSQL . " {$whereSQL} {$orderSQL} LIMIT {$offset} , {$maxperpage}"); //echo iCMS_DB::$last_query; //iCMS_DB::$last_query='explain '.iCMS_DB::$last_query; //$explain=iCMS_DB::getRow(iCMS_DB::$last_query); //var_dump($explain); $_count = count($rs); for ($i = 0; $i < $_count; $i++) { $rs[$i]['pic'] && ($rs[$i]['pic'] = uploadpath($rs[$i]['pic'], '+http')); $F = $forum[$rs[$i]['fid']]; $rs[$i]['sort']['name'] = $F['name']; $rs[$i]['sort']['url'] = $iCMS->iurl('forum', $F)->href; $rs[$i]['sort']['link'] = "<a href='{$rs[$i]['sort']['url']}'>{$rs[$i]['sort']['name']}</a>"; $rs[$i]['url'] = $iCMS->iurl('show', array($rs[$i], $F))->href; $rs[$i]['link'] = "<a href='{$rs[$i]['url']}'>{$rs[$i]['title']}</a>"; if ($rs[$i]['tags'] && isset($vars['tag'])) { $tagarray = explode(',', $rs[$i]['tags']); foreach ($tagarray as $tk => $tag) { $t = $iCMS->getTag($tag); if ($t) { $rs[$i]['tag'][$tk]['name'] = $tag; $rs[$i]['tag'][$tk]['url'] = $t['url']; $rs[$i]['taglink'] .= '<a href="' . $rs[$i]['tag'][$tk]['url'] . '" class="tag" target="_self">' . $tag . '</a> '; } } } } $iscache && $iCMS->SetCache($cacheName, $rs, $cacheTime); } return $rs; }
</td> <td rowspan="2" valign="top" id="tdfile"><ul class="filelist fileheader"> <li class="name">名称</li> <li class="size">大小</li> <li class="date">修改日期</li> <li class="manage">管理</li> </ul><form action="<?php echo __ADMINCP__; ?> =files" method="post" target="iCMS_FRAME" id="iDF"> <div id="fList"> <?php $_FL = $L['FileList']; $_fCount = count($_FL); for ($i = 0; $i < $_fCount; $i++) { $href = $do == 'template' ? $iCMS->config['url'] . '/templates/' . $_FL[$i]['path'] : uploadpath($_FL[$i]['path']); $filepath = $from == 'editor' ? $href : $_FL[$i]['path']; ?> <ul class="filelist"> <li class="name n" title="<?php echo $_FL[$i]['name']; ?> "><input type="checkbox" class="checkbox" name="files[]" value="<?php echo $href; ?> " /><a href="<?php echo $href; ?> " class="icon" target="_blank" title="点击查看"><?php echo $_FL[$i]['icon']; ?>
function remotepic(&$content, $intro = '', $autopic = false) { global $iCMS; $content = stripslashes($content); $img = array(); preg_match_all("/<img.*?src\\s*=[\"|'|\\s]*((http|file):\\/\\/.*?\\.(gif|jpg|jpeg|bmp|png)).*?>/is", $content, $match); $_array = (array) array_unique($match[1]); $uri = parse_url($iCMS->config['uploadURL']); foreach ($_array as $_k => $imgurl) { if (strstr(strtolower($imgurl), $uri['host'])) { unset($_array[$_k]); } } if (empty($_array)) { return; } set_time_limit(0); $RootPath = self::path_join(iPATH, $iCMS->config['uploadfiledir']) . '/'; //绝对路径 $FileDir = ""; if ($iCMS->config['savedir']) { $FileDir = str_replace(array('Y', 'y', 'm', 'n', 'd', 'j', 'H', 'EXT'), array(get_date('', 'Y'), get_date('', 'y'), get_date('', 'm'), get_date('', 'n'), get_date('', 'd'), get_date('', 'j'), get_date('', 'H'), $FileExt), $iCMS->config['savedir']); } $RootPath = $RootPath . $FileDir . "/"; $milliSecond = 'remote_' . get_date('', "YmdHis") . rand(1, 99999); self::mkdir($RootPath); require_once iPATH . 'include/snoopy.class.php'; require_once iPATH . 'include/upload.class.php'; $Snoopy = new Snoopy(); $Snoopy->agent = "Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-CN; rv:1.9.1.5) Gecko/20091102 Firefox/3.5.5"; $Snoopy->accept = "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"; foreach ($_array as $key => $value) { $FileExt = strtolower(FS::getExt($value)); //ļʽ iUpload::CheckValidExt($value); //判断文件类型 //过滤文件; strstr($FileExt, 'ph') && ($FileExt = "phpfile"); in_array($FileExt, array('cer', 'htr', 'cdx', 'asa', 'asp', 'jsp', 'aspx', 'cgi')) && ($FileExt .= "file"); $FileRootPathTmp = $RootPath . $milliSecond . $key . "." . $FileExt; $Snoopy->fetch($value); if ($Snoopy->results) { self::write($FileRootPathTmp, $Snoopy->results); $FileMd5 = md5_file($FileRootPathTmp); $rs = iCMS_DB::getRow("SELECT * FROM #iCMS@__file WHERE `filename`='{$FileMd5}' LIMIT 1"); if (empty($rs)) { $FileName = $FileMd5 . "." . $FileExt; $FilePath = $FileDir . "/" . $FileName; $FileRootPath = $RootPath . $FileName; rename($FileRootPathTmp, $FileRootPath); if (in_array($FileExt, array('gif', 'jpg', 'jpeg', 'png'))) { if ($iCMS->config['isthumb'] && ($iCMS->config['thumbwidth'] || $iCMS->config['thumbhight'])) { list($width, $height, $imagetype) = getimagesize($FileRootPath); if ($width > $iCMS->config['thumbwidth'] || $height > $iCMS->config['thumbhight']) { self::mkdir($RootPath . "thumb"); } $Thumbnail = iUpload::thumbnail($RootPath, $FileRootPath, $FileMd5); !empty($Thumbnail['filepath']) && $iCMS->config['thumbwatermark'] && iUpload::watermark($Thumbnail['filepath']); } iUpload::watermark($FileRootPath); } $_FileSize = @filesize($FileRootPath); empty($_FileSize) && ($_FileSize = 0); iCMS_DB::query("INSERT INTO `#iCMS@__file` (`filename`,`ofilename`,`path`,`intro`,`ext`,`size` ,`time`,`type`) VALUES ('{$FileMd5}', '{$value}', '{$FileDir}','{$intro}', '{$FileExt}', '{$_FileSize}', '" . time() . "', '1') "); } else { $FilePath = $rs->path . "/" . $rs->filename . "." . $rs->ext; self::del($FileRootPathTmp); } $content = str_replace($value, uploadpath($FilePath, '+http'), $content); if ($autopic && $key == 0) { break; } } } $content = addslashes($content); }