예제 #1
0
 function Index($tpl, $name = '', $p = 1, $loop = 0)
 {
     global $iCMS;
     $GLOBALS['page'] = $p;
     $iCMS->mode = 'CreateHtml';
     $iCMS->htmlConf = array('enable' => true, 'ext' => $iCMS->config['htmlext']);
     empty($name) && ($name = 'index');
     $filepath = FS::path(iPATH . $name . $iCMS->config['htmlext']);
     $filedir = dirname($filepath);
     $filename = basename($filepath);
     $fname = substr($filename, 0, strrpos($filename, '.'));
     $iCMS->pageurl = './' . $fname . '_';
     $html = $iCMS->Index($tpl, $name);
     $p == 1 && FS::write($filepath, $html, false);
     if ($iCMS->pagesize > 0) {
         $p++;
         FS::write($filedir . '/' . $fname . '_' . $p . $iCMS->config['htmlext'], $html, false);
     }
     empty($loop) && ($loop = ceil($iCMS->pagesize / 10));
     if ($p <= $iCMS->pagesize && $iCMS->pagesize > 0 && $loop == ceil(($iCMS->pagesize - $p) / 10)) {
         return self::Index($tpl, $name, $p, $loop);
     } else {
         return array('page' => $p, 'loop' => $loop, 'pagesize' => $iCMS->pagesize);
     }
 }
예제 #2
0
 function Index($tpl, $name = '')
 {
     global $iCMS;
     $iCMS->mode = 'CreateHtml';
     $iCMS->htmlConf = array('enable' => true, 'ext' => $iCMS->config['htmlext']);
     empty($name) && ($name = 'index');
     $filename = FS::path(iPATH . $name . $iCMS->config['htmlext']);
     return FS::write($filename, $iCMS->Index($tpl, $name), false);
 }
예제 #3
0
function iCMS_advertise($vars, &$iCMS)
{
    if (empty($vars['name'])) {
        echo $iCMS->language('empty:TPL_advName');
        return false;
    }
    $rs = $iCMS->getCache('system/adm/' . md5($vars['name']));
    if ($rs->status != '1') {
        return false;
    }
    $file = FS::path($iCMS->config['htmlURL'] . '/!adm') . '/';
    switch ($rs->load) {
        case "js":
            $file .= "{$rs->style}-{$rs->id}.js";
            echo "<script src=\"" . $file . "\" language=\"javascript\"></script>";
            break;
        case "iframe":
            $file .= "{$rs->style}-{$rs->id}.html";
            if ($rs->style == "image") {
                $rs->code['image']['width'] && ($width = " width=\"{$rs->code['image']['width']}\"");
                $rs->code['image']['height'] && ($height = " height=\"{$rs->code['image']['height']}\"");
            } elseif ($rs->style == "flash") {
                $rs->code['flash']['width'] && ($width = " width=\"{$rs->code['flash']['width']}\"");
                $rs->code['flash']['height'] && ($height = " height=\"{$rs->code['flash']['height']}\"");
            }
            echo '<iframe src="' . $file . '" name="' . $rs->style . '-id-' . $rs->id . '"' . $width . $height . ' frameborder="0"scrolling="no" style="overflow: visible;"></iframe>';
            break;
        case "shtml":
            $file .= "{$rs->style}-{$rs->id}.shtml";
            $uri = parse_url($file);
            echo '<!--#include virtual="' . $uri['path'] . '"-->';
            break;
        default:
            if (time() >= $rs->starttime && (time() <= $rs->endtime || empty($rs->endtime))) {
                echo adm($rs);
            }
    }
}
예제 #4
0
function adm($rs)
{
    global $iCMS;
    $rs->code = stripslashes_deep(unserialize($rs->code));
    $file = FS::path(iPATH . $iCMS->config['htmldir'] . '/!adm') . '/';
    FS::mkdir($file);
    switch ($rs->load) {
        case "js":
            $file .= "{$rs->style}-{$rs->id}.js";
            $html = "/*\n广告:{$rs->varname}\n标签:<!--{iCMS:advertise name=\"{$rs->varname}\"}-->\n*/\n";
            if ($rs->status) {
                $html .= "var timestamp = Date.parse(new Date());\n";
                $html .= "var startime = Date.parse(new Date(\"" . get_date($rs->starttime, 'Y/m/d') . "\"));\n";
                $rs->endtime && ($html .= "var endtime = Date.parse(new Date(\"" . get_date($rs->endtime, 'Y/m/d') . "\"));\n");
                $html .= "if(timestamp>=startime";
                $rs->endtime && ($html .= "||timestamp<endtime");
                $html .= "){\n";
                $html .= document(getadvhtml($rs->style, $rs->code));
                $html .= "}";
            }
            break;
        case "iframe":
            $file .= "{$rs->style}-{$rs->id}.html";
            $html = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>无标题文档</title><script type="text/javascript">function resizeFrame(){try{ var frames=parent.document.documentElement.getElementsByTagName("iframe"); for(var i=0;i<frames.length;i++){ frames[i].style.height=document.body.scrollHeight+"px"; var topPos=location.href.indexOf("#top");if(topPos>0){location.href=location.href.substring(0,topPos)+"#top1"}break;}}}catch(e){return;}}</script></head><body>' . getadvhtml($rs->style, $rs->code) . '</body><script type="text/javascript">resizeFrame();</scrip</html>';
            break;
        case "shtml":
            $file .= "{$rs->style}-{$rs->id}.shtml";
            $html = getadvhtml($rs->style, $rs->code);
            break;
    }
    $rs->src = $file;
    $iCMS->setCache('system/adm/' . md5($rs->varname), $rs, 0);
    if ($fn) {
        return $file;
    }
    $rs->load && FS::write($file, $html);
}
예제 #5
0
 function iurl($uri, $a = array(), $p = 1)
 {
     $i = new stdClass();
     $htmldir = $this->config['htmldir'];
     $htmlURL = $this->config['htmlURL'];
     switch ($uri) {
         case 'forum':
             $rule = $a['mode'] == 0 ? '{PHP}' : $a['forumRule'];
             $i->href = $a['url'];
             break;
         case 'show':
             unset($a[1]['url']);
             $Furl = $this->iurl('forum', $a[1]);
             $rule = $a[1]['mode'] == 0 ? '{PHP}' : $a[1]['contentRule'];
             $i->href = $this->config['publicURL'] . "/link.php?id=" . $a[0]['id'] . "&url=" . irawurldecode($a[0]['url']);
             $a = array_merge($a[0], (array) $a[1]);
             break;
         case 'content':
             $rule = $this->config['ctRule'];
             $i->href = $this->config['publicURL'] . "/link.php?id=" . $a['id'] . "&url=" . irawurldecode($a['url']);
             break;
         case 'tag':
             //$Furl   = $this->iurl('forum',$a[1]);
             //$rule   = $a[1]['mode']==0?'{PHP}':($a[1]['tagRule']?$a[1]['tagRule']:$this->config['tagRule']);
             $a[0]['tName'] = $a[0]['name'];
             $a = array_merge($a[0], (array) $a[1]);
             $rule = $this->config['tagRule'];
             $htmldir = $this->config['tagDir'];
             $htmlURL = $this->config['tagURL'];
             break;
     }
     if ($a['url']) {
         return $i;
     }
     $url = preg_replace("/\\{(.*?)\\}/e", '$this->irule($uri,"\\1",$a,$p)', $rule);
     if (strstr($rule, '{PHP}') === false) {
         $i->path = FS::path(iPATH . $htmldir . '/' . $url);
         $i->href = FS::path($htmlURL . '/' . $url);
         if (in_array($uri, array('show', 'content'))) {
             $i->path = FS::path($Furl->dmdir . '/' . $url);
             $i->href = FS::path($Furl->domain . '/' . $url);
         }
         $i->hdir = dirname($i->href);
         $i->file = basename($i->path);
         $i->name = substr($i->file, 0, strrpos($i->file, '.'));
         empty($i->name) && ($i->name = $i->file);
         $i->ext = strrchr($i->file, ".");
         if (empty($i->file) || substr($url, -1) == '/' || empty($i->ext)) {
             $i->name = 'index';
             $i->ext = empty($a['htmlext']) ? $this->config['htmlext'] : $a['htmlext'];
             $i->file = $i->name . $i->ext;
             $i->path = $i->path . '/' . $i->file;
             $i->hdir = dirname($i->href . '/' . $i->file);
         }
         //           var_dump($i);
         $i->dir = dirname($i->path);
         if (in_array($uri, array('show', 'content'))) {
             if (strstr($rule, '{P}') === false && $p > 1) {
                 $fn = $i->name . '_' . $p . $i->ext;
                 $i->path = $i->dir . '/' . $fn;
                 $i->href = $i->hdir . '/' . $fn;
             }
         }
         if ($uri == 'forum') {
             $m = $this->domain($a['fid']);
             if ($m->domain) {
                 $i->href = str_replace($i->hdir, $m->dmpath, $i->href);
                 $i->hdir = $m->dmpath;
                 $__dir__ = $i->dir . '#iCMS#' . $m->pdir;
                 $i->path = str_replace($i->dir, $__dir__, $i->path);
                 $i->dir = str_replace($m->sdir . '#iCMS#' . $m->pdir, $m->pdir, $__dir__);
                 $i->path = str_replace($__dir__, $i->dir, $i->path);
                 $i->dmdir = FS::path(iPATH . $htmldir . '/' . $m->pd . '/');
                 $bits = parse_url($i->href);
                 $i->domain = $bits['scheme'] . '://' . $bits['host'];
             } else {
                 $i->dmdir = FS::path(iPATH . $htmldir . '/');
                 $i->domain = $htmlURL;
             }
         }
         //            var_dump($i);
     } else {
         $i->href = $url;
         $p > 1 && ($i->href .= '&p=' . $p);
     }
     return $i;
 }
예제 #6
0
 function doreremote()
 {
     require_once iPATH . 'include/snoopy.class.php';
     $Snoopy = new Snoopy();
     $Snoopy->agent = "Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-CN; rv:1.9.1.5) Gecko/20091102 Firefox/3.5.5";
     $Snoopy->accept = "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8";
     $Snoopy->fetch($_GET['url']);
     $path = urldecode($_GET['path']);
     FS::write(FS::path(iPATH . $this->iCMS->config['uploadfiledir'] . '/' . $path), $Snoopy->results);
     javascript::dialog($_GET['url'] . '<br />下载完成!');
 }