Пример #1
0
    echo iFS::icon($filepath, './app/admincp/ui');
    ?>
</a>
                <a class="tip" title="<?php 
    echo $filepath;
    ?>
<hr />源文件名:<?php 
    echo $rs[$i]['ofilename'];
    ?>
"><?php 
    echo $rs[$i]['filename'] . '.' . $rs[$i]['ext'];
    ?>
</a>
              </td>
              <td><?php 
    echo iFS::sizeUnit($rs[$i]['size']);
    ?>
<br/><?php 
    echo get_date($rs[$i]['time'], 'Y-m-d');
    ?>
</td>
              <td>
                <a class="btn btn-small" href="<?php 
    echo $href;
    ?>
" data-toggle="modal" title="查看"><i class="fa fa-eye"></i> 查看</a>
                <?php 
    if (iACP::MP('FILE.EDIT')) {
        ?>
                <a class="btn btn-small" href="<?php 
        echo APP_FURI;
Пример #2
0
    ?>
</td>
            <td><?php 
    echo $rs[$i]['Rows'];
    ?>
</td>
            <td><?php 
    echo iFS::sizeUnit($rs[$i]['Data_length']);
    ?>
</td>
            <td><?php 
    echo iFS::sizeUnit($rs[$i]['Index_length']);
    ?>
</td>
            <td><?php 
    echo iFS::sizeUnit($rs[$i]['Data_length'] + $rs[$i]['Index_length']);
    ?>
</td>
            <td><?php 
    echo $rs[$i]['Create_time'];
    ?>
</td>
            <td><?php 
    echo $rs[$i]['Update_time'];
    ?>
</td>
            <td><?php 
    echo $rs[$i]['Collation'];
    ?>
</td>
            <td><?php 
Пример #3
0
 public static function crawl($_pid = NULL, $_rid = NULL, $_url = NULL, $_title = NULL)
 {
     ini_get('safe_mode') or set_time_limit(0);
     $sid = spider::$sid;
     if ($sid) {
         $sRs = iDB::row("SELECT * FROM `#iCMS@__spider_url` WHERE `id`='{$sid}' LIMIT 1;");
         $title = $sRs->title;
         $cid = $sRs->cid;
         $pid = $sRs->pid;
         $url = $sRs->url;
         $rid = $sRs->rid;
     } else {
         $rid = spider::$rid;
         $pid = spider::$pid;
         $title = spider::$title;
         $url = spider::$url;
         $_rid === NULL or $rid = $_rid;
         $_pid === NULL or $pid = $_pid;
         $_title === NULL or $title = $_title;
         $_url === NULL or $url = $_url;
     }
     if ($pid) {
         $project = spider::project($pid);
         $prule_list_url = $project['list_url'];
     }
     $ruleA = spider::rule($rid);
     $rule = $ruleA['rule'];
     $dataArray = $rule['data'];
     if ($prule_list_url) {
         $rule['list_url'] = $prule_list_url;
     }
     if (spider::$dataTest) {
         echo "<b>抓取规则信息</b><pre>";
         print_r(iS::escapeStr($ruleA));
         print_r(iS::escapeStr($project));
         echo "</pre><hr />";
     }
     spider::$curl_proxy = $rule['proxy'];
     $responses = array();
     $html = spiderTools::remote($url);
     if (empty($html)) {
         $msg = '错误:001..采集 ' . $url . '文件内容为空!请检查采集规则';
         if (spider::$work == 'shell') {
             echo "{$msg}\n";
             return false;
         } else {
             iPHP::alert($msg);
         }
     }
     //      $http   = spider::check_content_code($html);
     //
     //      if($http['match']==false){
     //          return false;
     //      }
     //      $content        = $http['content'];
     spider::$allHtml = "";
     $rule['__url__'] = spider::$url;
     $responses['reurl'] = spider::$url;
     $responses['__title__'] = $title;
     foreach ((array) $dataArray as $key => $data) {
         $content_html = $html;
         $dname = $data['name'];
         /**
          * [UNSET:name]
          * 注销[name]
          * @var string
          */
         if (strpos($dname, 'UNSET:') !== false) {
             $_dname = str_replace('UNSET:', '', $dname);
             unset($responses[$_dname]);
             continue;
         }
         /**
          * [DATA:name]
          * 把之前[name]处理完的数据当作原始数据
          * 如果之前有数据会叠加
          * 用于数据多次处理
          * @var string
          */
         if (strpos($dname, 'DATA:') !== false) {
             $_dname = str_replace('DATA:', '', $dname);
             $content_html = $responses[$_dname];
             unset($responses[$dname]);
         }
         /**
          * [PRE:name]
          * 把PRE:name采集到的数据 当做原始数据
          * 一般用于下载内容
          * @var string
          */
         $pre_dname = 'PRE:' . $dname;
         if (isset($responses[$pre_dname])) {
             $content_html = $responses[$pre_dname];
             unset($responses[$pre_dname]);
         }
         /**
          * [EMPTY:name]
          * 如果[name]之前抓取结果数据为空使用这个数据项替换
          * @var string
          */
         if (strpos($dname, 'EMPTY:') !== false) {
             $_dname = str_replace('EMPTY:', '', $dname);
             if (empty($responses[$_dname])) {
                 $dname = $_dname;
             } else {
                 //有值不执行抓取
                 continue;
             }
         }
         $content = spiderContent::crawl($content_html, $data, $rule, $responses);
         unset($content_html);
         if (strpos($dname, 'ARRAY:') !== false) {
             // if(strpos($data['rule'], 'RULE@')!==false){
             $dname = str_replace('ARRAY:', '', $dname);
             // $contentArray = $responses[$dname];
             // // $contentArray = $responses[$dname];
             $cArray = array();
             foreach ((array) $content as $k => $value) {
                 foreach ((array) $value as $key => $val) {
                     $cArray[$key][$k] = $val;
                 }
             }
             if ($cArray) {
                 $content = $cArray;
                 unset($cArray);
             }
         }
         /**
          * [name.xxx]
          * 采集内容做为数组
          */
         if (strpos($dname, '.') !== false) {
             $f_key = substr($dname, 0, stripos($dname, "."));
             $s_key = substr(strrchr($dname, "."), 1);
             if (isset($responses[$f_key][$s_key])) {
                 if (is_array($responses[$f_key][$s_key])) {
                     $responses[$f_key][$s_key] = array_merge($responses[$f_key][$s_key], $content);
                 } else {
                     $responses[$f_key][$s_key] .= $content;
                 }
             } else {
                 $responses[$f_key][$s_key] = $content;
             }
         } else {
             /**
              * 多个name 内容合并
              */
             if (isset($responses[$dname])) {
                 if (is_array($responses[$dname])) {
                     $responses[$dname] = array_merge($responses[$dname], $content);
                 } else {
                     $responses[$dname] .= $content;
                 }
             } else {
                 $responses[$dname] = $content;
             }
         }
         /**
          * 对匹配多条的数据去重过滤
          */
         if (!is_array($responses[$dname]) && $data['multi']) {
             if (strpos($responses[$dname], ',') !== false) {
                 $_dnameArray = explode(',', $responses[$dname]);
                 $dnameArray = array();
                 foreach ((array) $_dnameArray as $key => $value) {
                     $value = trim($value);
                     $value && ($dnameArray[] = $value);
                 }
                 $dnameArray = array_filter($dnameArray);
                 $dnameArray = array_unique($dnameArray);
                 $responses[$dname] = implode(',', $dnameArray);
                 unset($dnameArray, $_dnameArray);
             }
         }
         gc_collect_cycles();
     }
     if (isset($responses['title']) && empty($responses['title'])) {
         $responses['title'] = $responses['__title__'];
     }
     spider::$allHtml = null;
     unset($html);
     gc_collect_cycles();
     if (spider::$dataTest) {
         echo "<pre style='width:99%;word-wrap: break-word;'>";
         print_r(iS::escapeStr($responses));
         echo '<hr />';
         echo '使用内存:' . iFS::sizeUnit(memory_get_usage()) . ' 执行时间:' . iPHP::timer_stop() . 's';
         echo "</pre>";
     }
     iFS::$CURLOPT_ENCODING = '';
     iFS::$CURLOPT_REFERER = '';
     iFS::$watermark_config['pos'] = iCMS::$config['watermark']['pos'];
     iFS::$watermark_config['x'] = iCMS::$config['watermark']['x'];
     iFS::$watermark_config['y'] = iCMS::$config['watermark']['y'];
     iFS::$watermark_config['img'] = iCMS::$config['watermark']['img'];
     $rule['fs']['encoding'] && (iFS::$CURLOPT_ENCODING = $rule['fs']['encoding']);
     $rule['fs']['referer'] && (iFS::$CURLOPT_REFERER = $rule['fs']['referer']);
     if ($rule['watermark_mode']) {
         iFS::$watermark_config['pos'] = $rule['watermark']['pos'];
         iFS::$watermark_config['x'] = $rule['watermark']['x'];
         iFS::$watermark_config['y'] = $rule['watermark']['y'];
         $rule['watermark']['img'] && (iFS::$watermark_config['img'] = $rule['watermark']['img']);
     }
     if (spider::$callback['data'] && is_callable(spider::$callback['data'])) {
         $responses = call_user_func_array(spider::$callback['data'], array($responses));
     }
     return $responses;
 }
Пример #4
0
 public static function folder($dir = '', $type = NULL)
 {
     $dir = trim($dir, '/');
     $sDir = $dir;
     $_GET['dir'] && ($gDir = trim($_GET['dir'], '/'));
     // print_r('$dir='.$dir.'<br />');
     // print_r('$gDir='.$gDir.'<br />');
     //$gDir && $dir = $gDir;
     //strstr($dir,'.')!==false  && self::alert('What are you doing?','',1000000);
     //strstr($dir,'..')!==false && self::alert('What are you doing?','',1000000);
     $sDir_PATH = iFS::path_join(iPATH, $sDir);
     $iDir_PATH = iFS::path_join($sDir_PATH, $gDir);
     // print_r('$sDir_PATH='.$sDir_PATH."\n");
     // print_r('$iDir_PATH='.$iDir_PATH."\n");
     strpos($iDir_PATH, $sDir_PATH) === false && self::_error(array('code' => 0, 'state' => 'DIR_Error'));
     if (!is_dir($iDir_PATH)) {
         return false;
     }
     $url = buildurl(false, 'dir');
     if ($handle = opendir($iDir_PATH)) {
         while (false !== ($rs = readdir($handle))) {
             // print_r('$rs='.$rs."\n");
             $filepath = iFS::path_join($iDir_PATH, $rs);
             $filepath = rtrim($filepath, '/');
             //              print_r('$filepath='.$filepath."\n");
             $sFileType = @filetype($filepath);
             //              print_r('$sFileType='.$sFileType."\n");
             // var_dump($sDir_PATH,$filepath);
             $path = str_replace($sDir_PATH, '', $filepath);
             $path = ltrim($path, '/');
             if ($sFileType == "dir" && !in_array($rs, array('.', '..', 'admincp'))) {
                 $dirArray[] = array('path' => $path, 'name' => $rs, 'url' => $url . urlencode($path));
             }
             if ($sFileType == "file" && !in_array($rs, array('..', '.iPHP'))) {
                 $filext = iFS::get_ext($rs);
                 $fileinfo = array('path' => $path, 'dir' => dirname($path), 'url' => iFS::fp($path, '+http'), 'name' => $rs, 'modified' => get_date(filemtime($filepath), "Y-m-d H:i:s"), 'md5' => md5_file($filepath), 'ext' => $filext, 'size' => iFS::sizeUnit(filesize($filepath)));
                 if ($type) {
                     in_array(strtolower($filext), $type) && ($fileArray[] = $fileinfo);
                 } else {
                     $fileArray[] = $fileinfo;
                 }
             }
         }
     }
     $a['DirArray'] = (array) $dirArray;
     $a['FileArray'] = (array) $fileArray;
     $a['pwd'] = str_replace($sDir_PATH, '', $iDir_PATH);
     $a['pwd'] = trim($a['pwd'], '/');
     $pos = strripos($a['pwd'], '/');
     $a['parent'] = ltrim(substr($a['pwd'], 0, $pos), '/');
     $a['URI'] = $url;
     // var_dump($a);
     //      exit;
     return $a;
 }
Пример #5
0
/**
 * @package iCMS
 * @copyright 2007-2010, iDreamSoft
 * @license http://www.idreamsoft.com iDreamSoft
 * @author coolmoo <*****@*****.**>
 * @$Id: footer.php 2381 2014-03-21 04:03:07Z coolmoo $
 */
defined('iPHP') or exit('What are you doing?');
//var_dump(iMember::$cpower);
$memory = memory_get_usage();
?>
  <div class="clearfloat"></div>
  <div class="iCMS-container hide">
    <span class="label label-success">
      使用内存:<?php 
echo iFS::sizeUnit($memory);
?>
 执行时间:<?php 
echo iPHP::timer_stop();
?>
 s
    </span>
  </div>
</div>
<a id="scrollUp" href="#top"></a>
<div class="iCMS-batch">
  <div id="weightBatch">
    <div class="input-prepend"><span class="add-on">权重</span>
      <input type="text" class="span2" name="mweight"/>
    </div>
  </div>
Пример #6
0
</strong> <small>内链</small></li>
            <li><i class="fa fa-thumb-tack"></i> <strong><?php 
echo $pc;
?>
</strong> <small>推送</small></li>
            <li class="divider"></li>
            <li><i class="fa fa-heart"></i> <strong><?php 
echo $lc;
?>
</strong> <small>友链</small></li>
          </ul>
        </div>
        <div class="span3">
          <ul class="site-stats">
            <li><i class="fa fa-database"></i> <strong><?php 
echo iFS::sizeUnit($datasize + $indexsize);
?>
</strong> <small>数据库</small></li>
            <li><i class="fa fa-puzzle-piece"></i> <strong><?php 
echo count($iTable);
?>
</strong><small>iCMS表</small></li>
            <li><i class="fa fa-puzzle-piece"></i> <strong><?php 
echo count($oTable);
?>
</strong> <small>其它表</small></li>
            <li class="divider"></li>
            <li><i class="fa fa-files-o"></i> <strong><?php 
echo $fdc;
?>
</strong> <small>文件</small></li>