Пример #1
0
 /**
  * Build queue
  * @return null
  */
 public function get_queue()
 {
     global $zbp;
     foreach (get_included_files() as $name => $value) {
         $this->set_queue('check_bom', $value);
     }
     $dir = $zbp->path . 'zb_system/defend/default/';
     $files = GetFilesInDir($dir, 'php');
     foreach ($files as $sortname => $fullname) {
         $this->set_queue('check_bom', $fullname);
     }
     $dir = $zbp->usersdir . 'theme/' . $zbp->theme . '/template/';
     $files = GetFilesInDir($dir, 'php');
     foreach ($files as $sortname => $fullname) {
         $this->set_queue('check_bom', $fullname);
     }
 }
Пример #2
0
 public function BuildTemplate()
 {
     if (strpos('|SAE|BAE2|ACE|', '|' . $this->option['ZC_YUN_SITE'] . '|') !== false) {
         return false;
     }
     //初始化模板
     $this->LoadTemplates();
     if (strpos($this->templates['comments'], 'AjaxCommentBegin') === false) {
         $this->templates['comments'] = '<label id="AjaxCommentBegin"></label>' . $this->templates['comments'];
     }
     if (strpos($this->templates['comments'], 'AjaxCommentEnd') === false) {
         $this->templates['comments'] = $this->templates['comments'] . '<label id="AjaxCommentEnd"></label>';
     }
     if (strpos($this->templates['comment'], 'id="cmt{$comment->ID}"') === false && strpos($this->templates['comment'], 'id=\'cmt{$comment->ID}\'') === false) {
         $this->templates['comment'] = '<label id="cmt{$comment->ID}"></label>' . $this->templates['comment'];
     }
     if (strpos($this->templates['commentpost'], 'inpVerify') === false) {
         $verify = '{if $option[\'ZC_COMMENT_VERIFY_ENABLE\'] && !$user.ID}<p><input type="text" name="inpVerify" id="inpVerify" class="text" value="" size="28" tabindex="4" /> <label for="inpVerify">' . $this->lang['msg']['validcode'] . '(*)</label><img style="width:{$option[\'ZC_VERIFYCODE_WIDTH\']}px;height:{$option[\'ZC_VERIFYCODE_HEIGHT\']}px;cursor:pointer;" src="{$article.ValidCodeUrl}" alt="" title="" onclick="javascript:this.src=\'{$article.ValidCodeUrl}&amp;tm=\'+Math.random();"/></p>{/if}';
         if (strpos($this->templates['commentpost'], '<!--verify-->') !== false) {
             $this->templates['commentpost'] = str_replace('<!--verify-->', $verify, $this->templates['commentpost']);
         } elseif (strpos($this->templates['commentpost'], '</form>') !== false) {
             $this->templates['commentpost'] = str_replace('</form>', $verify . '</form>', $this->templates['commentpost']);
         } else {
             $this->templates['commentpost'] .= $verify;
         }
     }
     if (strpos($this->templates['header'], '{$header}') === false) {
         if (strpos($this->templates['header'], '</head>') !== false) {
             $this->templates['header'] = str_replace('</head>', '</head>' . '{$header}', $this->templates['header']);
         } elseif (strpos($this->templates['header'], '</ head>') !== false) {
             $this->templates['header'] = str_replace('</ head>', '</ head>' . '{$header}', $this->templates['header']);
         } else {
             $this->templates['header'] .= '{$header}';
         }
     }
     if (strpos($this->templates['footer'], '{$footer}') === false) {
         if (strpos($this->templates['footer'], '</body>') !== false) {
             $this->templates['footer'] = str_replace('</body>', '{$footer}' . '</body>', $this->templates['footer']);
         } elseif (strpos($this->templates['footer'], '</ body>') !== false) {
             $this->templates['footer'] = str_replace('</ body>', '{$footer}' . '</ body>', $this->templates['footer']);
         } elseif (strpos($this->templates['footer'], '</html>') !== false) {
             $this->templates['footer'] = str_replace('</html>', '{$footer}' . '</html>', $this->templates['footer']);
         } elseif (strpos($this->templates['footer'], '</ html>') !== false) {
             $this->templates['footer'] = str_replace('</ html>', '{$footer}' . '</ html>', $this->templates['footer']);
         } else {
             $this->templates['footer'] = '{$footer}' . $this->templates['footer'];
         }
     }
     $dir = $this->usersdir . 'theme/' . $this->theme . '/compile/';
     if (!file_exists($dir)) {
         @mkdir($dir, 0777, true);
     }
     $files2 = array();
     foreach ($this->templates as $name => $file) {
         $files2[] = $dir . $name . '.php';
     }
     //清空目标目录
     $files = GetFilesInDir($dir, 'php');
     $files3 = array_diff($files, $files2);
     foreach ($files3 as $fullname) {
         @unlink($fullname);
     }
     //创建模板类
     $this->template = new Template();
     $this->template->SetPath($dir);
     //模板接口
     foreach ($GLOBALS['Filter_Plugin_Zbp_BuildTemplate'] as $fpname => &$fpsignal) {
         $fpname($this->templates);
     }
     $this->template->CompileFiles($this->templates);
     $this->cache->refesh = time();
     $this->SaveCache();
 }
Пример #3
0
require dirname(__FILE__) . '/function.php';

$zbp->Load();

$action='root';
if (!$zbp->CheckRights($action)) {$zbp->ShowError(6);die();}

if (!$zbp->CheckPlugin('AppCentre')) {$zbp->ShowError(48);die();}

$blogtitle='应用中心-插件编辑';

if (GetVars('id'))
{
  $app = $zbp->LoadApp('plugin',GetVars('id'));
  $mt=array();
  $ft=GetFilesInDir($zbp->path . '/zb_users/plugin/' . $app->id . '/','php|inc|png');
  foreach($ft as $f){
    $mt[]=filemtime($f);
  }
  rsort($mt);
  if(count($mt)==0)$mt[]=time();
  $app->modified = date('Y-m-d', reset($mt));
}
else
{
  $app = new App;
  $app->price=0;
  $app->version='1.0';
  $app->pubdate=date('Y-m-d',time());
  $app->modified=date('Y-m-d',time());
  $v=array_keys($zbpvers);
Пример #4
0
/**
 * 生成语言select表单
 * @param $default
 * @return string
 */
function CreateOptionsOfLang($default)
{
    global $zbp;
    $s = '';
    $dir = $zbp->usersdir . 'language/';
    $files = GetFilesInDir($dir, 'php');
    foreach ($files as $f) {
        $n = basename($f, '.php');
        $t = (require $f);
        $s .= '<option value="' . $n . '" ' . ($default == $n ? 'selected="selected"' : '') . ' >' . $t['lang'] . ' (' . $n . ')' . '</option>';
    }
    return $s;
}
Пример #5
0
 public function GetCssFiles()
 {
     global $zbp;
     $dir = $zbp->usersdir . 'theme/' . $this->id . '/style/';
     return GetFilesInDir($dir, 'css');
 }
Пример #6
0
 /**
  * 载入未编译模板s
  */
 public function LoadTemplates()
 {
     global $zbp;
     $theme = $this->theme;
     $templates = array();
     // 读取预置模板
     $files = GetFilesInDir($zbp->path . 'zb_system/defend/default/', 'php');
     foreach ($files as $sortname => $fullname) {
         $templates[$sortname] = file_get_contents($fullname);
     }
     // 读取主题模板
     $files = GetFilesInDir($zbp->usersdir . 'theme/' . $theme . '/template/', 'php');
     foreach ($files as $sortname => $fullname) {
         $templates[$sortname] = file_get_contents($fullname);
     }
     for ($i = 2; $i <= 5; $i++) {
         if (!isset($templates['sidebar' . $i])) {
             $templates['sidebar' . $i] = str_replace('$sidebar', '$sidebar' . $i, $templates['sidebar']);
         }
     }
     $this->templates = $templates;
 }
Пример #7
0
 public function BuildTemplate()
 {
     if ($this->option['ZC_YUN_SITE']) {
         return false;
     }
     //初始化模板
     $this->LoadTemplates();
     if (strpos($this->templates['comments'], 'AjaxCommentBegin') === false) {
         $this->templates['comments'] = '<label id="AjaxCommentBegin"></label>' . $this->templates['comments'];
     }
     if (strpos($this->templates['comments'], 'AjaxCommentEnd') === false) {
         $this->templates['comments'] = $this->templates['comments'] . '<label id="AjaxCommentEnd"></label>';
     }
     if (strpos($this->templates['comment'], 'id="cmt{$comment->ID}"') === false && strpos($this->templates['comment'], 'id=\'cmt{$comment->ID}\'') === false) {
         $this->templates['comment'] = '<label id="cmt{$comment->ID}"></label>' . $this->templates['comment'];
     }
     $dir = $this->usersdir . 'theme/' . $this->theme . '/compile/';
     if (!file_exists($dir)) {
         @mkdir($dir, 0777, true);
     }
     $files2 = array();
     foreach ($this->templates as $name => $file) {
         $files2[] = $dir . $name . '.php';
     }
     //清空目标目录
     $files = GetFilesInDir($dir, 'php');
     $files3 = array_diff($files, $files2);
     foreach ($files3 as $fullname) {
         @unlink($fullname);
     }
     //创建模板类
     $this->template = new Template();
     $this->template->SetPath($dir);
     //模板接口
     foreach ($GLOBALS['Filter_Plugin_Zbp_BuildTemplate'] as $fpname => &$fpsignal) {
         $fpname($this->template);
     }
     $this->template->CompileFiles($this->templates);
     $this->cache->refesh = time();
     $this->SaveCache();
 }
Пример #8
0
/**
 * 生成语言select表单
 * @param $default
 * @return string
 */
function CreateOptionsOfLang($default)
{
    global $zbp;
    $s = '';
    $dir = $zbp->usersdir . 'language/';
    $files = GetFilesInDir($dir, 'php');
    foreach ($files as $f) {
        $n = basename($f, '.php');
        //fix 1.3 to 1.4 warning
        if ('SimpChinese' == $n) {
            continue;
        }
        if ('TradChinese' == $n) {
            continue;
        }
        $t = (require $f);
        $s .= '<option value="' . $n . '" ' . ($default == $n ? 'selected="selected"' : '') . ' >' . $t['lang_name'] . ' (' . $n . ')' . '</option>';
    }
    return $s;
}
Пример #9
0
 /**
  * 载入模块列表
  * @return null
  */
 public function LoadModules()
 {
     $this->modules = array();
     $this->modulesbyfilename = array();
     $array = $this->GetModuleList();
     foreach ($array as $m) {
         $this->modules[] = $m;
         $this->modulesbyfilename[$m->FileName] = $m;
     }
     $dir = $this->usersdir . 'theme/' . $this->theme . '/include/';
     if (file_exists($dir)) {
         $files = GetFilesInDir($dir, 'php');
         foreach ($files as $sortname => $fullname) {
             $m = new Module();
             $m->FileName = $sortname;
             $m->Content = file_get_contents($fullname);
             $m->Type = 'div';
             $m->Source = 'theme';
             $this->modules[] = $m;
             $this->modulesbyfilename[$m->FileName] = $m;
         }
     }
     foreach ($this->modules as $m) {
         $m->Content = str_replace('{$host}', $this->host, $m->Content);
     }
 }
Пример #10
0
    foreach ($ft as $f) {
        $mt[] = filemtime($f);
    }
    $ft = GetFilesInDir($zbp->path . '/zb_users/theme/' . $app->id . '/include/', 'php|inc|png');
    foreach ($ft as $f) {
        $mt[] = filemtime($f);
    }
    $ft = GetFilesInDir($zbp->path . '/zb_users/theme/' . $app->id . '/style/', 'php|inc|png');
    foreach ($ft as $f) {
        $mt[] = filemtime($f);
    }
    $ft = GetFilesInDir($zbp->path . '/zb_users/theme/' . $app->id . '/template/', 'php|inc|png');
    foreach ($ft as $f) {
        $mt[] = filemtime($f);
    }
    $ft = GetFilesInDir($zbp->path . '/zb_users/theme/' . $app->id . '/source/', 'php|inc|png');
    foreach ($ft as $f) {
        $mt[] = filemtime($f);
    }
    rsort($mt);
    if (count($mt) == 0) {
        $mt[] = time();
    }
    $app->modified = date('Y-m-d', reset($mt));
} else {
    $app = new App();
    $app->price = 0;
    $app->version = '1.0';
    $app->pubdate = date('Y-m-d', time());
    $app->modified = date('Y-m-d', time());
    $v = array_keys($zbpvers);