Exemplo n.º 1
0
      </ul>
    </div>
  </div>

  <div class="field">
    <h3><?php 
echo __('Script(s)');
?>
</h3>
    <div>
      <ul>
        <?php 
foreach ($resource->scriptOfDescription as $code) {
    ?>
          <li><?php 
    echo format_script($code);
    ?>
</li>
        <?php 
}
?>
      </ul>
    </div>
  </div>

  <?php 
echo render_show(__('Sources'), render_value($resource->getSources(array('cultureFallback' => true))));
?>

  <?php 
foreach ($resource->getNotesByType(array('noteTypeId' => QubitTerm::ARCHIVIST_NOTE_ID)) as $item) {
Exemplo n.º 2
0
function fetch_web($schemas, $test = null)
{
    global $_user, $_channels;
    $updated_file = array();
    foreach ($schemas as $k => $v) {
        if (!$v->channel && $v->url == '' || $v->keywords == '') {
            continue;
        }
        if ($v->channel) {
            $url_arr = $_channels[$v->channel]['url'];
        } else {
            $url_arr = explode(' ', $v->url);
        }
        foreach ($url_arr as $url_key => $url) {
            $url = mkurl($v->channel, $url_key, $url, $v->url);
            $filename = md5($url) . '.tmp';
            if (in_array($filename, $updated_file)) {
                $html = file_get_contents(CACHE_PATH . $filename);
            } else {
                $file = '';
                $context = $v->channel ? mkfp_context($url_key) : null;
                $html = file_get_contents($url, false, $context);
                $html = format_script($html);
                file_put_contents(CACHE_PATH . $filename, $html);
                $updated_file[] = $filename;
            }
            //处理关键词
            $keywords = $v->keywords;
            $encoding = mb_detect_encoding($html, array('ASCII', 'GB2312', 'GBK', 'UTF-8'));
            if ($encoding == 'EUC-CN') {
                $encoding = 'GB2312';
                $keywords = iconv('UTF-8', 'GBK', $keywords);
            } elseif ($encoding == 'CP936') {
                $keywords = iconv('UTF-8', $encoding, $keywords);
            }
            $keywords = explode(' ', $keywords);
            $first_key = array_shift($keywords);
            $lpos = 0;
            $rpos = NULL;
            $len = strlen($first_key);
            for ($lpos = strpos($html, $first_key, $lpos); $lpos !== false; $lpos = strpos($html, $first_key, $lpos + $len)) {
                $rpos = find_key($html, $keywords, $lpos + $len);
                if ($rpos) {
                    $html_len = strlen($html);
                    //得到关键词上下文
                    for ($j = 1; $j < 6 && $lpos !== false; $j++) {
                        $lpos = strrpos($html, '</', $lpos - $html_len - 2);
                    }
                    if (!$lpos) {
                        $lpos = 0;
                    }
                    for ($i = 1; $i < 5; $i++) {
                        $rpos = strpos($html, '</', $rpos + 2);
                    }
                    if (!$rpos) {
                        $rpos = $html_len;
                    }
                    $result = substr($html, $lpos, $rpos - $lpos);
                    break;
                }
            }
            $result = trim(strip_tags($result, '<a>'));
            //确定包含数字
            if ($v->max_num != '' || $v->min_num != '') {
                $result = find_num($result, $v->max_num, $v->min_num);
            }
            if ($result) {
                $result = str_replace(array("\n", "\r", "\t", "  "), '', $result);
                if ($encoding != 'UTF-8') {
                    $result = substr($result, 0, 400);
                    $result = iconv('GBK', 'UTF-8', $result);
                } else {
                    $result = mb_substr($result, 0, 400, 'utf8');
                }
                $website = isset($_channels[$v->channel]['website'][$url_key]) ? $_channels[$v->channel]['website'][$url_key] : $url;
                $content = $result . "<a href='{$website}' target='_blank'>查看</a>";
                if ($test) {
                    return $content;
                } else {
                    $_user = user::get_one(array('user_id' => $v->user_id));
                    schema::update(array('status' => 'off', 'schema_id' => $v->schema_id));
                    msg::add(array('schema_id' => $v->schema_id, 'title' => $v->title, 'content' => $content, 'status' => 'new'));
                    $email = filter_var($_user->email, FILTER_VALIDATE_EMAIL);
                    if ($_user->email_notify == 'on' && $email) {
                        mail::send_cron($email, $v->title, $content);
                    }
                    if ($_user->app_notify == 'on' && $_user->baidu_uid) {
                        push::push_message($_user->baidu_uid, $v->title, $result);
                    }
                }
                $result = NULL;
                break;
            }
        }
    }
}
Exemplo n.º 3
0
<!-- File info section -->
<aside id="info_zone" class="hide">
	<h1 id="namep"></h1>
	<p id="buttonp"><button id="delete" class="negative"><?php 
echo __('Delete');
?>
</button><button id="view" class="affirmative"><?php 
echo __('View');
?>
</button></p>
</aside>

<script type="application/javascript" src="js/zepto.min.js"></script>
<script type="application/javascript" src="js/ui.js"></script>
<script type="application/javascript">
<?php 
echo format_script($filem, $page);
?>
</script>

<!-- Footer -->
<footer id="main_footer">
<p><?php 
echo __('This site is powered by <a target="_blank" href="http://github.com/qakcn/qchan">Qchan %s</a>', QCHAN_VER);
?>
</p>
</footer>

</body>
</html>
Exemplo n.º 4
0
</button>
				</div>
			</section>
		</div>
	</div>

</section>

<!-- File info section -->
<aside id="info_zone" class="hide">
</aside>

<script type="application/javascript" src="<?php 
echo get_url() . theme_path();
?>
js/zepto.min.js"></script>
<?php 
echo embed_script();
?>
<script type="application/javascript" src="<?php 
echo get_url() . theme_path();
?>
js/ui.js"></script>
<script type="application/javascript">
<?php 
echo $results != null ? format_script($results) : '';
?>
</script>

<?php 
load_footer();