Esempio n. 1
0
function LIB_getUploadImage($upfiles, $d, $content, $ext)
{
    $imgs = getImgs($content, $ext);
    if ($imgs[0]) {
        if (!$upfiles) {
            return $imgs[0];
        }
        $basename = basename($imgs[0]);
        $encname = md5($basename);
        $folder = substr($d, 0, 4) . '/' . substr($d, 4, 2) . '/' . substr($d, 6, 2);
        if (is_file($GLOBALS['g']['path_file'] . $folder . '/' . $encname)) {
            return str_replace($basename, '', $imgs[0]) . $encname;
        }
    }
    if ($upfiles) {
        $upArray = getArrayString($upfiles);
        foreach ($upArray['data'] as $_val) {
            $U = getUidData($GLOBALS['table']['s_upload'], $_val);
            if (!$U['uid']) {
                continue;
            }
            if (strpos('_jpg,gif,png', $U['ext'])) {
                return $U['url'] . $U['folder'] . '/' . $U['thumbname'];
            }
        }
    }
}
Esempio n. 2
0
 function getpost($id)
 {
     $post = $this->select('post_title', 'id', 'post_content', 'created_at', 'post_keywords', 'post_description')->find($id);
     $post->post_keywords = $post->post_keywords == '' ? $post->post_title : $post->post_keywords;
     $content = mb_ereg_replace(' ', "\n", strip_tags($post->post_content));
     $content = strlen($content) > 30 ? mb_substr($content, 0, 30, 'UTF-8') . '...' : $content;
     $post->post_description = $post->post_description == '' ? $content : $post->post_description;
     $imgarr = getImgs($post->post_content);
     if (count($imgarr) > 0) {
     }
     Cache::put('post' . $id, $post, 10);
     return $post;
 }
Esempio n. 3
0
    function imgsOfServer($server){
        $url_CPU='../Portail Unique Capacitaire1.htm';
        $url_Memory='../Portail Unique Capacitaire2.htm';
        $url_Disque='../Portail Unique Capacitaire3.htm';
        $url_Network='../Portail Unique Capacitaire4.htm';
        $url_Workload='../Portail Unique Capacitaire5.htm';

        $tag=array(
            'Server'    =>    $server,
            'CPU'       =>    getImgs($url_CPU),
            'Memory'    =>    getImgs($url_Memory),
            'Disque'    =>    getImgs($url_Disque),
            'Network'   =>    getImgs($url_Network),
            'Workload'  =>    getImgs($url_Workload)
        );
        return $tag;
    }
Esempio n. 4
0
@section('websiteDescription')
	<h2>上 善 若 水</h2>
	<p style=" color: #7AE4DE;">水善利万物而不争,处众人之所恶,故几于道。居,善地;心,善渊;与,善仁;言,善信;政,善治;事,善能;动,善时。夫唯不争,故无尤。</p>
@stop

@section('navi')
	
@stop

@section('post')
<?php 
echo '<h2 class="title_tj"><p>最新<span>发布</span></p></h2>';
// $posts_obj = json_decode($posts);
// $posts=$posts_obj->data;
foreach ($posts as $post) {
    $img_url = getImgs($post->post_content, 0);
    $web_url = getcwd();
    $img_def_url = '/images/thumbnail.png';
    $img_url = $web_url . $img_url;
    //echo $img_url;
    $img_url = is_file($img_url) ? $img_url : $img_def_url;
    $post_date = substr($post->post_date, 0, 10);
    echo "<h3>[<a href='/fenlei' target='_blank'>分类</a>]<a href='/post/{$post->id}.html' target='_blank'>" . $post->post_title . "</a></h3>";
    echo "<figure><img src='" . $img_url . "'></figure>";
    echo "<ul><p>" . mb_substr(strip_tags($post->post_content), 0, 300, 'gb2312') . "</p></ul>";
    echo '<div class="dateview"><a title="' . $post->post_title . '" href="/post/' . $post->id . '.html" target="_blank" class="readmore">阅读全文>></a><span>' . $post_date . '</span><span>阅读(10)</span><span>评论(2)</span> <a href="javascript:(0)" class="post-like" data-pid="533" data-event="like"><i class="glyphicon glyphicon-thumbs-up"></i>赞(0)</a></span></div>';
}
//print_r($posts->lastPage());
//$cur_page = $_GET['page'];
$total = $posts->total();
//总文章数
Esempio n. 5
0
		<div class="tt">
			<div class="ts"><?php 
        echo $_B['name'];
        ?>
</div>
			<div class="tmore"><a href="<?php 
        echo RW('m=bbs&bid=' . $_B['id']);
        ?>
">더보기</a></div>
			<div class="clear"></div>
		</div>
		<?php 
        if ($_R['uid']) {
            ?>
		<?php 
            $_IMG = getImgs($_R['content'], 'jpg|jpeg');
            ?>
		<div class="thumb"><a href="<?php 
            echo getPostLink($_R);
            ?>
"><img src="<?php 
            echo $_IMG[0] ? $_IMG[0] : $g['img_core'] . '/blank.gif';
            ?>
" alt="" /></a></div>
		<div class="tsubject"><a href="<?php 
            echo getPostLink($_R);
            ?>
"><?php 
            echo $_R['subject'];
            ?>
</a></div>
Esempio n. 6
0
 public function getArt($cate, $child = true, $uid, $status, $order, $field = true, $row, $onetag, $title, $position, $limit, $focus)
 {
     if ($onetag != '') {
         $map['tag'] = array('like', '%' . $onetag . '%');
     }
     if ($position != '') {
         $map['tj'] = array('in', $position);
     }
     if ($title != '') {
         $map['title'] = array('like', '%' . $title . '%');
     }
     if ($child) {
         $cateids = D('Home/Cate')->getChildrenId($cate);
     } else {
         $cateids = $cate;
     }
     if ($uid != 0) {
         $map['uid'] = array('in', $uid);
     }
     if ($cateids != null) {
         $map['cid'] = array('in', $cateids);
     }
     $map['status'] = array('in', $status);
     if ($focus) {
         $loginuid = is_login();
         $focusuid = M('focus')->where(array('id' => $loginuid, 'type' => 0))->getField('rowid', true);
         $focustag = M('focus')->where(array('id' => $loginuid, 'type' => 2))->getField('rowid', true);
         if ($focustag != null) {
             foreach ($focustag as $key => $vo) {
                 $focustagarr[$key] = '%' . M('tags')->where(array('id' => $vo))->getField('title') . '%';
             }
             $where['tag'] = array('like', $focustagarr, 'OR');
             if ($focusuid != null) {
                 $where['uid'] = array('in', $focusuid);
                 $where['_logic'] = 'or';
             }
             $map['_complex'] = $where;
         } else {
             if ($focusuid != null) {
                 $where['uid'] = array('in', $focusuid);
                 $map['_complex'] = $where;
             } else {
                 $map['status'] = -1;
             }
         }
     }
     $count = $this->model->where($map)->count();
     if ($count > 0) {
         $p = I(C('VAR_PAGE'));
         if ($limit) {
             $data = $this->model->where($map)->order($order)->limit($row)->field($field)->select();
         } else {
             $data = $this->model->where($map)->order($order)->page(!empty($p) ? $p : 1, $row)->field($field)->select();
         }
     }
     if ($data == null) {
         $this->apiError("获取文章列表失败", null);
     } else {
         foreach ($data as $key => $vo) {
             if ($vo['tj'] == 1) {
                 $data[$key]['titleicon'] = '[<i class="icon-thumbs-up"></i> 推荐]';
             }
             if ($vo['tj'] == 2) {
                 $data[$key]['titleicon'] = '[<i class="icon-arrow-up"></i> 置顶]';
             }
             $data[$key]['yesedit'] = getarteditauth($vo['id'], $uid) || is_admin($uid);
             $data[$key]['img'] = getImgs($vo['description'], 0);
             $data[$key]['user'] = query_user(array('nickname', 'username', 'space_url', 'avatar32', 'avatar64'), $vo['uid']);
             if ($title != '') {
                 $data[$key]['title'] = str_replace($title, '<b style="color:red">' . $title . '</b>', $vo['title']);
             }
             if (!empty($vo['tag'])) {
                 $tags = explode(',', $vo['tag']);
                 $data[$key]['linktag'] = '';
                 foreach ($tags as $key1 => $vo1) {
                     $maptag['title'] = $vo1;
                     $maptag['type'] = 1;
                     $tagid = M('tags')->where($maptag)->getField('id');
                     $url = CSU('/tagart/' . $tagid, 'Index/tagart', array('id' => $tagid));
                     if ($onetag != '' && $onetag == $vo1) {
                         $data[$key]['linktag'] .= '<a style="margin-left:5px;color:red;" href="' . $url . '">[' . $vo1 . ']</a>';
                     } else {
                         $data[$key]['linktag'] .= '<a style="margin-left:5px;" href="' . $url . '">[' . $vo1 . ']</a>';
                     }
                 }
             }
         }
         $this->apiSuccess("获取文章列表成功", null, array('data' => $data));
     }
 }
<?php

$time_start = microtime(true);
$search = isset($_GET["q"]) ? $_GET["q"] : null;
if (!$search) {
    echo "nothing search.";
    exit;
}
$urls = array();
$urls[] = "https://twitter.com/search?q=" . $search . "&src=typd";
$urls[] = "https://fr.images.search.yahoo.com/search/images;_ylt=A9mSs21TTRhUj3AAcBxjAQx.;_ylu=X3oDMTB1bmJlc2FhBHNlYwNzYwRjb2xvA2lyMgR2dGlkA1VJRlJDMDFfMQ--?va=" . $search;
$urls[] = "http://www.bing.com/images/search?q=" . $search;
$urls[] = "http://fr.wikipedia.org/wiki/" . ucfirst(str_replace(" ", "_", $search));
$listPictures = array();
foreach ($urls as $url) {
    $listPictures = array_merge($listPictures, getImgs($url));
}
function getImgs($url)
{
    $curl = curl_init($url);
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($curl, CURLOPT_BINARYTRANSFER, true);
    $html = curl_exec($curl);
    preg_match_all("/<img .*>/", $html, $r);
    $tmp = array();
    $format = array("png", "jpg", "jpeg");
    foreach ($r[0] as $key => $value) {
        preg_match("/src=[\\'|\"]([^\\'|\"]*)/", $value, $urlImg);
        if ($urlImg) {
            $urlImg = $urlImg[1];
            if (!preg_match("/^http/", $urlImg)) {
Esempio n. 8
0
 public function wxevent($data)
 {
     $artid = C('WXARTID');
     $mapart['id'] = array('in', explode(',', $artid));
     $artarr = M('article')->where($mapart)->order('tj desc')->select();
     $art = array();
     foreach ($artarr as $key => $vo) {
         $art[$key] = array('Title' => $vo['title'], 'Description' => cutstr_html(op_t($vo['description']), 50), 'PicUrl' => getImgs($vo['description'], 0), 'Url' => (is_ssl() ? 'https://' : 'http://') . $_SERVER['HTTP_HOST'] . '/' . C('WEB_DIR') . '/' . CSU('/artc/' . $vo['id'], 'Index/artc', array('id' => $vo['id'])));
     }
     if ($data['event'] == 'subscribe') {
         $result = array('MsgType' => 'text', 'Content' => C('WXWELCOME'));
     }
     if ($data['event'] == 'CLICK') {
         if ($data['key'] == 'newblog') {
             $result = array('MsgType' => 'news', 'Content' => $art);
         }
     }
     switch ($result['MsgType']) {
         case 'text':
             $this->wx->text($result['Content'])->reply();
             break;
         case 'news':
             $this->wx->news($result['Content'])->reply();
             break;
     }
 }