Ejemplo n.º 1
1
function diff($from, $to)
{
    $from = mb_convert_encoding($from, 'HTML-ENTITIES', 'UTF-8');
    $to = mb_convert_encoding($to, 'HTML-ENTITIES', 'UTF-8');
    require_once AppFile::lib('finediff');
    $diff = new FineDiff($from, $to, FineDiff::$paragraphGranularity);
    $html = $diff->renderDiffToHTML();
    $html = mb_convert_encoding($html, 'UTF-8', 'HTML-ENTITIES');
    $html = html_entity_decode($html);
    $html = nl2br($html);
    return $html;
}
Ejemplo n.º 2
0
 public static function listModifiedFiles($time = null)
 {
     $cache = Yii::app()->cache;
     $files = $cache->get(AppFile::appFileInfoKey);
     // 如果取不到文件列表,重新生成
     if ($files === false) {
         $fileInfo = AppFile::fresh();
         $files = $fileInfo[1];
     }
     // 没指定时间,返回所有的文件列表
     if ($time === null) {
         return $files;
     }
     $re = array();
     foreach ($files as $file) {
         // 找到更新后的文件
         if ($file['mtime'] >= $time) {
             $re[] = $file;
         }
     }
     return $re;
 }
Ejemplo n.º 3
0
<?php

namespace PFC\Editor;

//use \PFC\Editor\AppLogin;
//use \PFC\Editor\AppFile;
//use \PFC\Editor\AppSess;
//do login if login form is submited
if (isset($_POST['pwd']) && isset($_POST['login']) && AppLogin::verify($_POST['login'], $_POST['pwd'], $_POST['pin'])) {
    AppLogin::setUserLoggedIn($_POST['pwd']);
    AppSess::set('pfc-login', true);
    AppFile::sendRedirectHeaders(preg_replace('/(login\\.action)$/', '', $_SERVER['REQUEST_URI']));
} else {
    AppFile::sendRedirectHeaders(preg_replace('/(login\\.action)$/', '', $_SERVER['REQUEST_URI']) . '?wrong-creditials');
}
Ejemplo n.º 4
0
function widget($name, $opts = array())
{
    extract($opts);
    include AppFile::view("widget.{$name}");
}
Ejemplo n.º 5
0
function render_view($view_file, $opts = array())
{
    extract($opts);
    include AppFile::view($view_file);
    // 渲染 view
}