Exemple #1
0
 function avatar($size = "24")
 {
     $_dir = ceil(self::$userid / 500);
     $avatar = 'avatar/' . $_dir . '/' . self::$userid . '_' . $size . '.gif';
     if (file_exists(iFS::fp($avatar, '+iPATH'))) {
         return iFS::fp($avatar);
     } else {
         return iCMS_PUBLIC_URL . '/common/avatar_' . $size . '.gif';
     }
 }
Exemple #2
0
/**
 * @package iCMS
 * @copyright 2007-2010, iDreamSoft
 * @license http://www.idreamsoft.com iDreamSoft
 * @author coolmoo <*****@*****.**>
 * @$Id: push.tpl.php 1392 2013-05-20 12:28:08Z coolmoo $
 */
function push_list($vars)
{
    $maxperpage = isset($vars['row']) ? (int) $vars['row'] : "100";
    $cache_time = isset($vars['time']) ? (int) $vars['time'] : "-1";
    $where_sql = "WHERE `status`='1'";
    isset($vars['userid']) && ($where_sql .= " AND `userid`='{$vars['userid']}'");
    if (isset($vars['cid!'])) {
        $ncids = explode(',', $vars['cid!']);
        $vars['sub'] && ($ncids += iCMS::get_category_ids($ncids, true));
        $where_sql .= iPHP::where($ncids, 'cid', 'not');
    }
    if (isset($vars['cid'])) {
        $cid = explode(',', $vars['cid']);
        $vars['sub'] && ($cid += iCMS::get_category_ids($cid, true));
        $where_sql .= iPHP::where($cid, 'cid');
    }
    isset($vars['pid']) && ($where_sql .= " AND `type` ='{$vars['pid']}'");
    isset($vars['pic']) && ($where_sql .= " AND `haspic`='1'");
    isset($vars['nopic']) && ($where_sql .= " AND `haspic`='0'");
    isset($vars['startdate']) && ($where_sql .= " AND `addtime`>='" . strtotime($vars['startdate']) . "'");
    isset($vars['enddate']) && ($where_sql .= " AND `addtime`<='" . strtotime($vars['enddate']) . "'");
    $by = $vars['by'] == "ASC" ? "ASC" : "DESC";
    switch ($vars['orderby']) {
        case "id":
            $order_sql = " ORDER BY `id` {$by}";
            break;
        case "addtime":
            $order_sql = " ORDER BY `addtime` {$by}";
            break;
        case "disorder":
            $order_sql = " ORDER BY `ordernum` {$by}";
            break;
        default:
            $order_sql = " ORDER BY `id` DESC";
    }
    if ($vars['cache']) {
        $cache_name = iPHP_DEVICE . '/push/' . md5($where_sql);
        $resource = iCache::get($cache_name);
    }
    if (empty($resource)) {
        $resource = iDB::all("SELECT * FROM `#iCMS@__push` {$where_sql} {$order_sql} LIMIT {$maxperpage}");
        iPHP_SQL_DEBUG && iDB::debug(1);
        if ($resource) {
            foreach ($resource as $key => $value) {
                $value['pic'] && ($value['pic'] = iFS::fp($value['pic'], '+http'));
                $value['pic2'] && ($value['pic2'] = iFS::fp($value['pic2'], '+http'));
                $value['pic2'] && ($value['pic2'] = iFS::fp($value['pic2'], '+http'));
                $value['metadata'] && ($value['metadata'] = unserialize($value['metadata']));
                $resource[$key] = $value;
            }
        }
        $vars['cache'] && iCache::set($cache_name, $resource, $cache_time);
    }
    return $resource;
}
Exemple #3
0
 function do_iCMS()
 {
     $res = iFS::folder('template', array('htm', 'css', 'js', 'png', 'jpg', 'gif'));
     $dirRs = $res['DirArray'];
     $fileRs = $res['FileArray'];
     $pwd = $res['pwd'];
     $parent = $res['parent'];
     $URI = $res['URI'];
     $navbar = true;
     $file_edit = true;
     include iACP::view("files.explorer");
 }
Exemple #4
0
function get_pic($src, $size = 0, $thumb = 0)
{
    if (empty($src)) {
        return array();
    }
    $data = array('src' => $src, 'url' => iFS::fp($src, '+http'));
    if ($size) {
        $data['width'] = $size['w'];
        $data['height'] = $size['h'];
    }
    if ($size && $thumb) {
        $data += bitscale(array("tw" => (int) $thumb['width'], "th" => (int) $thumb['height'], "w" => (int) $size['w'], "h" => (int) $size['h']));
    }
    return $data;
}
Exemple #5
0
 public static function init()
 {
     self::check_seccode();
     //验证码验证
     iMember::checkLogin();
     //用户登陆验证
     self::$menu = new iMenu();
     //初始化菜单
     self::MP('ADMINCP', 'page');
     //检查是否有后台权限
     self::MP('__MID__', 'page');
     //检查菜单ID
     self::$apps = array('home', 'category', 'pushcategory', 'tagcategory', 'article', 'push', 'prop', 'setting', 'filter', 'cache', 'tags', 'editor');
     iFS::$userid = iMember::$userid;
 }
Exemple #6
0
 public static function delete($frp)
 {
     if (!self::$config['enable']) {
         return false;
     }
     foreach ((array) self::$config['sdk'] as $vendor => $conf) {
         $fp = ltrim(iFS::fp($frp, '-iPATH'), '/');
         $client = self::yun($vendor);
         if ($client) {
             $res = $client->delete($conf['Bucket'], $fp);
             $res = json_decode($res, true);
             if ($res['error']) {
                 self::$error[$vendor] = array('action' => 'delete', 'code' => 0, 'state' => 'Error', 'msg' => $res['msg']);
             }
         }
     }
 }
Exemple #7
0
 public static function router($uid, $type, $size = 0)
 {
     switch ($type) {
         case 'avatar':
             return iCMS_FS_URL . get_user_pic($uid, $size);
             break;
         case 'url':
             return iPHP::router(array('/{uid}/', $uid), iPHP_ROUTER_REWRITE);
             break;
         case 'coverpic':
             $dir = get_user_dir($uid, 'coverpic');
             return array('pc' => iFS::fp($dir . '/' . $uid . ".jpg", '+http'), 'mo' => iFS::fp($dir . '/m_' . $uid . ".jpg", '+http'));
             break;
         case 'urls':
             return array('inbox' => iPHP::router(array('/user/inbox/{uid}', $uid), iPHP_ROUTER_REWRITE), 'home' => iPHP::router(array('/{uid}/', $uid), iPHP_ROUTER_REWRITE), 'comment' => iPHP::router(array('/{uid}/comment/', $uid), iPHP_ROUTER_REWRITE), 'favorite' => iPHP::router(array('/{uid}/favorite/', $uid), iPHP_ROUTER_REWRITE), 'fans' => iPHP::router(array('/{uid}/fans/', $uid), iPHP_ROUTER_REWRITE), 'follower' => iPHP::router(array('/{uid}/follower/', $uid), iPHP_ROUTER_REWRITE));
             break;
     }
 }
Exemple #8
0
 function getpic($path)
 {
     $uri = parse_url(iCMS_FS_URL);
     $pic = iS::escapeStr($path);
     if (stripos($pic, $uri['host']) === false) {
         stripos($pic, 'http://') === false or $pic = iFS::http($pic);
     } else {
         $pic = iFS::fp($pic, "-http");
     }
     return $pic;
 }
Exemple #9
0
 /**
  * 抓取资源
  * @param  [string] $html      [抓取结果]
  * @param  [array] $data      [数据项]
  * @param  [array] $rule      [规则]
  * @param  [array] $responses [已经抓取资源]
  * @return [array]           [返回处理结果]
  */
 public static function crawl($html, $data, $rule, $responses)
 {
     if (trim($data['rule']) === '') {
         return;
     }
     $name = $data['name'];
     if (spider::$dataTest) {
         print_r('<b>[' . $name . ']规则:</b>' . iS::escapeStr($data['rule']));
         echo "<hr />";
     }
     if (strpos($data['rule'], 'RULE@') !== false) {
         spider::$rid = str_replace('RULE@', '', $data['rule']);
         $_urls = trim($html);
         if (spider::$dataTest) {
             print_r('<b>使用[rid:' . spider::$rid . ']规则抓取</b>:' . $_urls);
             echo "<hr />";
         }
         return spiderUrls::crawl('DATA@RULE', false, spider::$rid, $_urls);
     }
     /**
      * RAND@10,0
      * 返回随机数
      */
     if (strpos($data['rule'], 'RAND@') !== false) {
         $random = str_replace('RAND@', '', $data['rule']);
         list($length, $numeric) = explode(',', $random);
         return random($length, empty($numeric) ? 0 : 1);
     }
     $contentArray = array();
     $contentHash = array();
     $_content = null;
     $_content = spiderContent::match($html, $data, $rule);
     $cmd5 = md5($_content);
     $contentArray[] = $_content;
     $contentHash[$cmd5] = true;
     if ($data['page']) {
         if (empty($rule['page_url'])) {
             $rule['page_url'] = $rule['list_url'];
         }
         if (empty(spider::$allHtml)) {
             $page_url_array = array();
             $page_area_rule = trim($rule['page_area_rule']);
             if ($page_area_rule) {
                 if (strpos($page_area_rule, 'DOM::') !== false) {
                     iPHP::import(iPHP_LIB . '/phpQuery.php');
                     $doc = phpQuery::newDocumentHTML($html, 'UTF-8');
                     $pq_dom = str_replace('DOM::', '', $page_area_rule);
                     $pq_array = phpQuery::pq($pq_dom);
                     foreach ($pq_array as $pn => $pq_val) {
                         $href = phpQuery::pq($pq_val)->attr('href');
                         if ($href) {
                             if ($rule['page_url_rule']) {
                                 if (strpos($rule['page_url_rule'], '<%') !== false) {
                                     $page_url_rule = spiderTools::pregTag($rule['page_url_rule']);
                                     if (!preg_match('|' . $page_url_rule . '|is', $href)) {
                                         continue;
                                     }
                                 } else {
                                     $cleanhref = spiderTools::dataClean($rule['page_url_rule'], $href);
                                     if ($cleanhref) {
                                         $href = $cleanhref;
                                         unset($cleanhref);
                                     } else {
                                         continue;
                                     }
                                 }
                             }
                             $href = str_replace('<%url%>', $href, $rule['page_url']);
                             $page_url_array[$pn] = spiderTools::url_complement($rule['__url__'], $href);
                         }
                     }
                     phpQuery::unloadDocuments($doc->getDocumentID());
                 } else {
                     $page_area_rule = spiderTools::pregTag($page_area_rule);
                     if ($page_area_rule) {
                         preg_match('|' . $page_area_rule . '|is', $html, $matches, $PREG_SET_ORDER);
                         $page_area = $matches['content'];
                     } else {
                         $page_area = $html;
                     }
                     if ($rule['page_url_rule']) {
                         $page_url_rule = spiderTools::pregTag($rule['page_url_rule']);
                         preg_match_all('|' . $page_url_rule . '|is', $page_area, $page_url_matches, PREG_SET_ORDER);
                         foreach ($page_url_matches as $pn => $row) {
                             $href = str_replace('<%url%>', $row['url'], $rule['page_url']);
                             $page_url_array[$pn] = spiderTools::url_complement($rule['__url__'], $href);
                             gc_collect_cycles();
                         }
                     }
                     unset($page_area);
                 }
             } else {
                 // 逻辑方式
                 if ($rule['page_url_parse'] == '<%url%>') {
                     $page_url = str_replace('<%url%>', $rule['__url__'], $rule['page_url']);
                 } else {
                     $page_url_rule = spiderTools::pregTag($rule['page_url_parse']);
                     preg_match('|' . $page_url_rule . '|is', $rule['__url__'], $matches, $PREG_SET_ORDER);
                     $page_url = str_replace('<%url%>', $matches['url'], $rule['page_url']);
                 }
                 if (stripos($page_url, '<%step%>') !== false) {
                     for ($pn = $rule['page_no_start']; $pn <= $rule['page_no_end']; $pn = $pn + $rule['page_no_step']) {
                         $page_url_array[$pn] = str_replace('<%step%>', $pn, $page_url);
                         gc_collect_cycles();
                     }
                 }
             }
             //URL去重清理
             if ($page_url_array) {
                 $page_url_array = array_filter($page_url_array);
                 $page_url_array = array_unique($page_url_array);
                 $puk = array_search($rule['__url__'], $page_url_array);
                 if ($puk !== false) {
                     unset($page_url_array[$puk]);
                 }
             }
             if (spider::$dataTest) {
                 echo "<b>内容页网址:</b>" . $rule['__url__'] . "<br />";
                 echo "<b>分页:</b>" . $rule['page_url'] . "<br />";
                 echo iS::escapeStr($page_url_rule);
                 echo "<hr />";
             }
             if (spider::$dataTest) {
                 echo "<b>分页列表:</b><pre>";
                 print_r($page_url_array);
                 echo "</pre><hr />";
             }
             spider::$content_right_code = trim($rule['page_url_right']);
             spider::$content_error_code = trim($rule['page_url_error']);
             spider::$curl_proxy = $rule['proxy'];
             $pageurl = array();
             foreach ($page_url_array as $pukey => $purl) {
                 //usleep(100);
                 $phtml = spiderTools::remote($purl);
                 if (empty($phtml)) {
                     break;
                 }
                 $md5 = md5($phtml);
                 if ($pageurl[$md5]) {
                     break;
                 }
                 $check_content = spiderTools::check_content_code($phtml);
                 if ($check_content === false) {
                     unset($check_content, $phtml);
                     break;
                 }
                 $_content = spiderContent::match($phtml, $data, $rule);
                 $cmd5 = md5($_content);
                 if ($contentHash[$cmd5]) {
                     break;
                 }
                 $contentArray[] = $_content;
                 $contentHash[$cmd5] = true;
                 $pageurl[$md5] = $purl;
                 spider::$allHtml[$md5] = $phtml;
             }
             gc_collect_cycles();
             unset($check_content, $phtml);
             if (spider::$dataTest) {
                 echo "<b>最终分页列表:</b><pre>";
                 print_r($pageurl);
                 echo "</pre><hr />";
             }
         } else {
             foreach ((array) spider::$allHtml as $ahkey => $phtml) {
                 $contentArray[] = spiderContent::match($phtml, $data, $rule);
             }
         }
     }
     $content = implode('#--iCMS.PageBreak--#', $contentArray);
     $html = null;
     unset($html, $contentArray, $contentHash, $_content);
     $content = stripslashes($content);
     if (spider::$dataTest) {
         print_r('<b>[' . $name . ']匹配结果:</b>' . htmlspecialchars($content));
         echo "<hr />";
     }
     if ($data['cleanbefor']) {
         $content = spiderTools::dataClean($data['cleanbefor'], $content);
     }
     /**
      * 在数据项里调用之前采集的数据[DATA@name][DATA@name.key]
      */
     if (strpos($content, '[DATA@') !== false) {
         $content = spiderTools::getDATA($responses, $content);
     }
     if ($data['cleanhtml']) {
         $content = stripslashes($content);
         $content = preg_replace('/<[\\/\\!]*?[^<>]*?>/is', '', $content);
     }
     if ($data['format'] && $content) {
         $content = autoformat($content);
     }
     if ($data['img_absolute'] && $content) {
         // $content = stripslashes($content);
         preg_match_all("/<img.*?src\\s*=[\"|'](.*?)[\"|']/is", $content, $img_match);
         if ($img_match[1]) {
             $_img_array = array_unique($img_match[1]);
             $_img_urls = array();
             foreach ((array) $_img_array as $_img_key => $_img_src) {
                 $_img_urls[$_img_key] = spiderTools::url_complement($rule['__url__'], $_img_src);
             }
             $content = str_replace($_img_array, $_img_urls, $content);
         }
         unset($img_match, $_img_array, $_img_urls, $_img_src);
     }
     if ($data['trim']) {
         $content = trim($content);
     }
     if ($data['capture']) {
         // $content = stripslashes($content);
         $content = spiderTools::remote($content);
     }
     if ($data['download']) {
         // $content = stripslashes($content);
         $content = iFS::http($content);
     }
     if ($data['cleanafter']) {
         $content = spiderTools::dataClean($data['cleanafter'], $content);
         // $content = stripslashes($content);
     }
     if ($data['autobreakpage']) {
         $content = spiderTools::autoBreakPage($content);
     }
     if ($data['mergepage']) {
         $content = spiderTools::mergePage($content);
     }
     if ($data['empty'] && empty($content)) {
         $emptyMsg = '[' . $name . ']规则设置了不允许为空.当前抓取结果为空!请检查,规则是否正确!';
         if (spider::$dataTest) {
             exit('<h1>' . $emptyMsg . '</h1>');
         }
         if (spider::$work) {
             echo "\n{$emptyMsg}\n";
             return false;
         } else {
             iPHP::alert($emptyMsg);
         }
     }
     if ($data['json_decode']) {
         $content = json_decode($content, true);
     }
     if ($data['array']) {
         return (array) $content;
     }
     if (spider::$callback['content'] && is_callable(spider::$callback['content'])) {
         $content = call_user_func_array(spider::$callback['content'], array($content));
     }
     return $content;
 }
Exemple #10
0
function pinyin($str, $split = "", $pn = true)
{
    if (!isset($GLOBALS["iPHP.PY"])) {
        $GLOBALS["iPHP.PY"] = unserialize(gzuncompress(iFS::read(iPHP_PATH . '/pinyin.table')));
    }
    preg_match_all('/[\\x01-\\x7f]|[\\xc2-\\xdf][\\x80-\\xbf]|[\\xe0-\\xef][\\x80-\\xbf]{2}|[\\xf0-\\xff][\\x80-\\xbf]{3}/', trim($str), $match);
    $s = $match[0];
    $c = count($s);
    for ($i = 0; $i < $c; $i++) {
        $uni = strtoupper(dechex(utf2uni($s[$i])));
        if (strlen($uni) > 2) {
            $pyArr = $GLOBALS["iPHP.PY"][$uni];
            $py = is_array($pyArr) ? $pyArr[0] : $pyArr;
            $pn && ($py = str_replace(array('1', '2', '3', '4', '5'), '', $py));
            $zh && $split && ($R[] = $split);
            $R[] = strtolower($py);
            $zh = true;
            $az09 = false;
        } else {
            if (preg_match("/[a-z0-9]/i", $s[$i])) {
                $zh && $i != 0 && !$az09 && $split && ($R[] = $split);
                $R[] = $s[$i];
                $zh = true;
                $az09 = true;
            } else {
                $sp = true;
                if ($split) {
                    if ($s[$i] == ' ') {
                        $R[] = $sp ? '' : $split;
                        $sp = false;
                    } else {
                        $R[] = $sp ? $split : '';
                        $sp = true;
                    }
                } else {
                    $R[] = '';
                }
                $zh = false;
                $az09 = false;
            }
        }
    }
    return str_replace(array('Üe', 'Üan', 'Ün', 'lÜ', 'nÜ'), array('ue', 'uan', 'un', 'lv', 'nv'), implode('', (array) $R));
}
Exemple #11
0
    echo $rs[$i]['name'];
    ?>
</a>
          </div>

        <?php 
    if ($rs[$i]['haspic']) {
        ?>
        <a href="<?php 
        echo APP_URI;
        ?>
&do=preview&id=<?php 
        echo $rs[$i]['id'];
        ?>
" data-toggle="modal" title="预览"><img src="<?php 
        echo iFS::fp($rs[$i]['pic']);
        ?>
" style="height:120px;"/></a>
        <?php 
    }
    ?>
          </td>
          <td><a href="<?php 
    echo APP_DOURI;
    ?>
&cid=<?php 
    echo $rs[$i]['cid'];
    echo $uri;
    ?>
"><?php 
    echo $C['name'];
Exemple #12
0
 function do_del()
 {
     $this->bakdir or iPHP::alert('请选择要删除的备份卷');
     $backupdir = iPHP_APP_CACHE . '/backup/' . $this->bakdir;
     if (iFS::rmdir($backupdir)) {
         iPHP::success('备份文件已删除!', 'js:parent.$("#' . md5($this->bakdir) . '").remove();');
     }
 }
Exemple #13
0
    if ($parent && !$parentShow) {
        ?>
            <tr>
              <td></td>
              <td colspan="7"><a href="<?php 
        echo $URI . $parent;
        ?>
"><i class="fa fa-angle-double-up"></i> 返回上级</a></td>
            </tr>
            <?php 
    }
    ?>
            <?php 
    $_count = count($fileRs);
    for ($i = 0; $i < $_count; $i++) {
        $icon = iFS::icon($fileRs[$i]['name'], './app/admincp/ui');
        ?>
            <tr>
              <td><input type="checkbox" value="<?php 
        echo $fileRs[$i]['path'];
        ?>
" url="<?php 
        echo $fileRs[$i]['url'];
        ?>
"  data-click="file"/></td>
              <td><?php 
        if (in_array(strtolower($fileRs[$i]['ext']), array('jpg', 'png', 'gif', 'jpeg'))) {
            ?>
                <a href="###" class="tip-right" title="<img src='<?php 
            echo $fileRs[$i]['url'];
            ?>
Exemple #14
0
 function Article($id)
 {
     $app = iCMS::run('article', 'article', 'object');
     $htm = $app->article($id);
     $htm or iPHP::alert("文章所属栏目URL规则设置问题! 此栏目下的文章不能生成静态,请修改栏目的访问模式和URL规则");
     $total = $htm[1]['page']['total'];
     $title = $htm[1]['title'];
     iFS::check_ext($htm[1]['iurl']->path) or iPHP::alert("文件类型不合法,禁止生成!<hr />请更改栏目->URL规则设置->内容规则");
     iFS::mkdir($htm[1]['iurl']->dir);
     iFS::write($htm[1]['iurl']->path, $htm[0]);
     if ($total >= 2) {
         for ($ap = 2; $ap <= $total; $ap++) {
             $htm = $app->article($id, $ap);
             $fpath = iPHP::p2num($htm[1]['iurl']->pagepath, $ap);
             iFS::write($fpath, $htm[0]);
         }
     }
     unset($app, $htm);
     return $title;
 }
Exemple #15
0
 public static function config()
 {
     $site = iPHP_MULTI_SITE ? $_SERVER['HTTP_HOST'] : iPHP_APP;
     if (iPHP_MULTI_DOMAIN) {
         //只绑定主域
         preg_match("/[^\\.\\/][\\w\\-]+\\.[^\\.\\/]+\$/", $site, $matches);
         $site = $matches[0];
     }
     iPHP_MULTI_SITE && define('iPHP_APP_SITE', $site);
     strpos($site, '..') === false or exit('<h1>What are you doing?(code:001)</h1>');
     //config.php 中开启iPHP_APP_CONF后 此处设置无效,
     define('iPHP_APP_CONF', iPHP_CONF_DIR . '/' . $site);
     //网站配置目录
     define('iPHP_APP_CONFIG', iPHP_APP_CONF . '/config.php');
     //网站配置文件
     @is_file(iPHP_APP_CONFIG) or exit('<h1>' . iPHP_APP . ' 运行出错.找不到"' . $site . '"网站的配置文件!(code:002)</h1>');
     $config = (require iPHP_APP_CONFIG);
     //config.php 中开启后 此处设置无效
     defined('iPHP_DEBUG') or define('iPHP_DEBUG', $config['debug']['php']);
     //程序调试模式
     defined('iPHP_TPL_DEBUG') or define('iPHP_TPL_DEBUG', $config['debug']['tpl']);
     //模板调试
     defined('iPHP_SQL_DEBUG') or define('iPHP_SQL_DEBUG', $config['debug']['sql']);
     //模板调试
     defined('iPHP_TIME_CORRECT') or define('iPHP_TIME_CORRECT', $config['time']['cvtime']);
     defined('iPHP_ROUTER_REWRITE') or define('iPHP_ROUTER_REWRITE', $config['router']['rewrite']);
     defined('iPHP_APP_SITE') && ($config['cache']['prefix'] = iPHP_APP_SITE);
     define('iPHP_ROUTER_USER', $config['router']['user_url']);
     define('iPHP_URL_404', $config['router']['404']);
     //404定义
     //config.php --END--
     ini_set('display_errors', 'OFF');
     error_reporting(0);
     if (iPHP_DEBUG || iPHP_TPL_DEBUG) {
         ini_set('display_errors', 'ON');
         error_reporting(E_ALL & ~E_NOTICE);
     }
     $timezone = $config['time']['zone'];
     $timezone or $timezone = 'Asia/Shanghai';
     //设置中国时区
     @ini_set('date.timezone', $timezone);
     function_exists('date_default_timezone_set') && @date_default_timezone_set($timezone);
     self::multiple_device($config);
     iFS::init($config['FS'], $config['watermark'], 'filedata');
     iCache::init($config['cache']);
     iPHP::template_start();
     iPHP_DEBUG && (iDB::$show_errors = true);
     iPHP_TPL_DEBUG && self::clear_compiled_tpl();
     self::$apps = $config['apps'];
     return $config;
 }
Exemple #16
0
 public function API_mobileUp()
 {
     $this->auth or iPHP::code(0, 'iCMS:!login', 0, 'json');
     $F = iFS::upload('upfile');
     $F['path'] && ($url = iFS::fp($F['path'], '+http'));
     iPHP::js_callback(array('url' => $url, 'code' => $F['code']));
 }
Exemple #17
0
&frame=iPHP" class="tip-bottom" target="iPHP_FRAME" title="生成静态文件"><i class="fa fa-file"></i></a>
                  <?php 
        }
        ?>
                </div>
                <?php 
        if ($value['pic'] && iCMS::$config['publish']['showpic']) {
            ?>
                <a href="<?php 
            echo APP_URI;
            ?>
&do=preview&id=<?php 
            echo $value['id'];
            ?>
" data-toggle="modal" title="预览"><img src="<?php 
            echo iFS::fp($value['pic']);
            ?>
" style="height:120px;"/></a>
                <?php 
        }
        ?>
              </td>
              <td><?php 
        if ($value['pubdate']) {
            echo get_date($value['pubdate'], 'Y-m-d H:i');
        }
        ?>
<br />
                <?php 
        if ($value['postime']) {
            echo get_date($value['postime'], 'Y-m-d H:i');
Exemple #18
0
 function do_uploadscrawl()
 {
     if ($_GET["action"] == "tmpImg") {
         // 背景上传
         iFS::$callback = false;
         $F = iFS::upload('upfile', 'scrawl/tmp');
         $F === false && exit;
         $F['path'] && ($url = iFS::fp($F['path'], '+http'));
         echo "<script>parent.ue_callback('" . $url . "','SUCCESS')</script>";
     } else {
         iFS::$callback = true;
         $F = iFS::base64ToFile($_POST['upfile'], 'scrawl/' . get_date(0, 'Y/md'));
         $F === false && exit(iFS::$ERROR);
         $F['path'] && ($url = iFS::fp($F['path'], '+http'));
         $tmp = iFS::get_dir() . "scrawl/tmp/";
         iFS::rmdir($tmp);
         iPHP::json(array("url" => $url, "state" => 'SUCCESS'));
     }
 }
Exemple #19
0
 function picdata($pic = '', $mpic = '', $spic = '')
 {
     $picdata = array();
     if ($pic) {
         list($width, $height, $type, $attr) = @getimagesize(iFS::fp($pic, '+iPATH'));
         $picdata['b'] = array('w' => $width, 'h' => $height);
     }
     if ($mpic) {
         list($width, $height, $type, $attr) = @getimagesize(iFS::fp($mpic, '+iPATH'));
         $picdata['m'] = array('w' => $width, 'h' => $height);
     }
     if ($spic) {
         list($width, $height, $type, $attr) = @getimagesize(iFS::fp($spic, '+iPATH'));
         $picdata['s'] = array('w' => $width, 'h' => $height);
     }
     return $picdata ? addslashes(serialize($picdata)) : '';
 }
Exemple #20
0
 function do_delfile()
 {
     iACP::MP('FILE.DELETE', 'alert');
     $_GET['path'] or iPHP::alert("请选择要删除的文件");
     strpos($_GET['path'], '..') !== false && iPHP::alert("文件路径中带有..");
     $hash = md5($_GET['path']);
     $FileRootPath = iFS::fp($_GET['path'], '+iPATH');
     if (iFS::del($FileRootPath)) {
         $msg = 'success:#:check:#:文件删除完成!';
         $_GET['ajax'] && iPHP::json(array('code' => 1, 'msg' => $msg));
     } else {
         $msg = 'warning:#:warning:#:找不到相关文件,文件删除失败!';
         $_GET['ajax'] && iPHP::json(array('code' => 0, 'msg' => $msg));
     }
     iPHP::dialog($msg, 'js:parent.$("#' . $hash . '").remove();');
 }
Exemple #21
0
 public static function http($http, $ret = '', $times = 0)
 {
     list($RootPath, $FileDir) = self::mk_udir($udir);
     // 文件保存目录方式
     $frs = self::getFileData('ofilename', $http);
     if ($frs) {
         if ($ret == 'array') {
             return self::_array(1, $frs, $RootPath);
         }
         return $frs->filepath;
     }
     $FileExt = self::valid_ext($http);
     //判断过滤文件类型
     if ($FileExt === false) {
         return false;
     }
     $fdata = self::remote($http);
     if ($fdata) {
         $file_md5 = md5($fdata);
         $frs = self::getFileData('filename', $file_md5);
         if ($frs) {
             $FilePath = $frs->filepath;
             $FileRootPath = iFS::fp($FilePath, "+iPATH");
             if (!is_file($FileRootPath)) {
                 self::mkdir(dirname($FileRootPath));
                 self::write($FileRootPath, $fdata);
                 self::watermark($FileExt, $FileRootPath);
                 self::yun_write($FileRootPath);
             }
             if ($ret == 'array') {
                 return self::_array(1, $frs, $RootPath);
             }
         } else {
             $FileName = $file_md5 . "." . $FileExt;
             $FilePath = $FileDir . $FileName;
             $FileRootPath = $RootPath . $FileName;
             self::write($FileRootPath, $fdata);
             self::watermark($FileExt, $FileRootPath);
             self::yun_write($FileRootPath);
             $FileSize = @filesize($FileRootPath);
             empty($FileSize) && ($FileSize = 0);
             $fid = self::insFileData(array('filename' => $file_md5, 'ofilename' => $http, 'path' => $FileDir, 'intro' => $intro, 'ext' => $FileExt, 'size' => $FileSize), 1);
             if ($ret == 'array') {
                 return array('code' => 1, 'fid' => $fid, 'md5' => $file_md5, 'size' => $FileSize, 'oname' => $http, 'name' => $FileName, 'fname' => $FileName . "." . $FileExt, 'dir' => $FileDir, 'ext' => $FileExt, 'RootPath' => $FileRootPath, 'path' => $FilePath, 'dirRootPath' => $RootPath);
             }
         }
         return $FilePath;
     } else {
         // if ($times < 3) {
         //     $times++;
         //     return self::http($http,$ret,$times);
         // } else {
         return false;
         // }
     }
 }
Exemple #22
0
 public static function get($uri, $a = array())
 {
     $i = new stdClass();
     $sURL = self::$config['URL'];
     $html_dir = self::$config['html_dir'];
     $router = self::$config['router'];
     $category = array();
     $array = $a;
     $PRI = $router[$uri]['PRI'];
     $rule = $router[$uri]['rule'];
     switch ($rule) {
         case '0':
             $i->href = $array['url'];
             $url = $array['urlRule'];
             break;
         case '1':
             $category = $array;
             $i->href = $category['url'];
             $url = $category['mode'] ? $category['categoryRule'] : '{PHP}';
             $category['password'] && $category['mode'] == "1" && ($url = '{PHP}');
             if ($url == '{PHP}') {
                 $document_uri = $uri . '.php?';
                 $category['categoryURI'] && ($document_uri = $category['categoryURI'] . '.php?');
                 $document_uri .= $PRI . '=' . $category[$PRI];
             }
             break;
         case '2':
             $array = (array) $a[0];
             $category = (array) $a[1];
             $i->href = $array['url'];
             $url = $category['mode'] ? $category['contentRule'] : '{PHP}';
             $category['password'] && $category['mode'] == "1" && ($url = '{PHP}');
             if ($url == '{PHP}') {
                 $document_uri = $uri . '.php?';
                 $document_uri .= $PRI . '=' . $array[$PRI];
                 $i->pageurl = $document_uri . '&p={P}';
                 strpos($i->pageurl, 'http://') === false && ($i->pageurl = rtrim($sURL, '/') . '/' . $i->pageurl);
             }
             break;
         case '3':
             $array = (array) $a[0];
             $category = (array) $a[1];
             $_category = (array) $a[2];
             $html_dir = self::$config['tag_dir'];
             $sURL = self::$config['tag_url'];
             $i->href = $array['url'];
             //$a       = array_merge_recursive((array)$a[0],$category);
             $url = $category['urlRule'];
             $_category['urlRule'] && ($url = $_category['urlRule']);
             $url or $url = self::$config['tag_rule'];
             if ($url == '{PHP}') {
                 $document_uri = $uri . '.php?';
                 $document_uri .= $PRI . '=' . $array[$PRI];
             }
             break;
         default:
             $url = $array['urlRule'];
     }
     if ($url == '{PHP}') {
         strpos($document_uri, 'http://') === false && ($document_uri = rtrim($sURL, '/') . '/' . $document_uri);
         $i->href = $document_uri;
     }
     if ($i->href) {
         return $i;
     }
     if (strpos($url, '{PHP}') === false) {
         self::$uriArray = array($array, $category, (array) $_category);
         strpos($url, '{') === false or $url = preg_replace_callback("/\\{(.*?)\\}/", '__iurl_rule__', $url);
         $i->path = rtrim(iFS::path(iPATH . $html_dir . $url), '/');
         if (strpos($html_dir, '..') === false) {
             $i->href = rtrim($sURL, '/') . '/' . ltrim(iFS::path($html_dir . $url), '/');
         } else {
             $i->href = rtrim($sURL, '/') . '/' . ltrim(iFS::path($url), '/');
         }
         $pathA = pathinfo($i->path);
         //            if(in_array($uri,array('article','content'))) {
         //                $i->path    = FS::path($Curl->dmdir.'/'.$url);
         //                $i->href    = FS::path($Curl->domain.'/'.$url);
         //            }
         $i->hdir = pathinfo($i->href, PATHINFO_DIRNAME);
         $i->dir = $pathA['dirname'];
         $i->file = $pathA['basename'];
         $i->name = $pathA['filename'];
         $i->ext = '.' . $pathA['extension'];
         $i->name or $i->name = $i->file;
         //var_dump($GLOBALS['page']);
         //var_dump($i);
         //var_dump($pathA);
         if (empty($i->file) || substr($url, -1) == '/' || empty($pathA['extension'])) {
             $i->name = 'index';
             $i->ext = self::$config['html_ext'];
             $category['htmlext'] && ($i->ext = $category['htmlext']);
             $i->file = $i->name . $i->ext;
             $i->path = $i->path . '/' . $i->file;
             $i->dir = dirname($i->path);
             $i->hdir = dirname($i->href . '/' . $i->file);
         }
         //var_dump($i);
         if (strpos($i->file, '{P}') === false) {
             $i->pfile = $i->name . "_{P}" . $i->ext;
         } else {
             $i->pfile = $i->file;
         }
         if ($rule == '0' || strpos($url, 'http://') !== false) {
             $hi = new stdClass();
             $hi->href = $url;
             $hi->ext = $i->ext;
             $hi->pageurl = $hi->href . '/' . $i->pfile;
             return $hi;
         }
         //var_dump($i);
         //exit;
         if ($rule == '1') {
             $m = self::domain($array['cid']);
             if ($m->domain) {
                 $i->href = str_replace($i->hdir, $m->dmpath, $i->href);
                 $i->hdir = $m->dmpath;
                 $__dir__ = $i->dir . '/' . $m->pdir;
                 $i->path = str_replace($i->dir, $__dir__, $i->path);
                 $i->dir = $__dir__;
                 $i->dmdir = iFS::path(iPATH . $html_dir . '/' . $m->pd);
                 $bits = parse_url($i->href);
                 $i->domain = $bits['scheme'] . '://' . $bits['host'];
             } else {
                 $i->dmdir = iFS::path(iPATH . $html_dir);
                 $i->domain = $sURL;
             }
             if (strpos($array['domain'], 'http://') !== false) {
                 $i->href = $array['domain'];
             }
         }
         $i->pageurl = $i->hdir . '/' . $i->pfile;
         $i->pagepath = $i->dir . '/' . $i->pfile;
         $i->href = str_replace('{P}', 1, $i->href);
         $i->path = str_replace('{P}', 1, $i->path);
         $i->file = str_replace('{P}', 1, $i->file);
         $i->name = str_replace('{P}', 1, $i->name);
         //var_dump($i);
         //exit;
     }
     return $i;
 }
Exemple #23
0
 function do_import_rule()
 {
     iFS::$checkFileData = false;
     iFS::$config['allow_ext'] = 'txt';
     iFS::$config['yun']['enable'] = false;
     $F = iFS::upload('upfile');
     $path = $F['RootPath'];
     if ($path) {
         $data = file_get_contents($path);
         if ($data) {
             $data = base64_decode($data);
             $data = unserialize($data);
             iDB::insert("spider_rule", $data);
         }
         @unlink($path);
         iPHP::success('规则导入完成', 'js:1');
     }
 }
Exemple #24
0
 public static function crawl($_pid = NULL, $_rid = NULL, $_url = NULL, $_title = NULL)
 {
     ini_get('safe_mode') or set_time_limit(0);
     $sid = spider::$sid;
     if ($sid) {
         $sRs = iDB::row("SELECT * FROM `#iCMS@__spider_url` WHERE `id`='{$sid}' LIMIT 1;");
         $title = $sRs->title;
         $cid = $sRs->cid;
         $pid = $sRs->pid;
         $url = $sRs->url;
         $rid = $sRs->rid;
     } else {
         $rid = spider::$rid;
         $pid = spider::$pid;
         $title = spider::$title;
         $url = spider::$url;
         $_rid === NULL or $rid = $_rid;
         $_pid === NULL or $pid = $_pid;
         $_title === NULL or $title = $_title;
         $_url === NULL or $url = $_url;
     }
     if ($pid) {
         $project = spider::project($pid);
         $prule_list_url = $project['list_url'];
     }
     $ruleA = spider::rule($rid);
     $rule = $ruleA['rule'];
     $dataArray = $rule['data'];
     if ($prule_list_url) {
         $rule['list_url'] = $prule_list_url;
     }
     if (spider::$dataTest) {
         echo "<b>抓取规则信息</b><pre>";
         print_r(iS::escapeStr($ruleA));
         print_r(iS::escapeStr($project));
         echo "</pre><hr />";
     }
     spider::$curl_proxy = $rule['proxy'];
     $responses = array();
     $html = spiderTools::remote($url);
     if (empty($html)) {
         $msg = '错误:001..采集 ' . $url . '文件内容为空!请检查采集规则';
         if (spider::$work == 'shell') {
             echo "{$msg}\n";
             return false;
         } else {
             iPHP::alert($msg);
         }
     }
     //      $http   = spider::check_content_code($html);
     //
     //      if($http['match']==false){
     //          return false;
     //      }
     //      $content        = $http['content'];
     spider::$allHtml = "";
     $rule['__url__'] = spider::$url;
     $responses['reurl'] = spider::$url;
     $responses['__title__'] = $title;
     foreach ((array) $dataArray as $key => $data) {
         $content_html = $html;
         $dname = $data['name'];
         /**
          * [UNSET:name]
          * 注销[name]
          * @var string
          */
         if (strpos($dname, 'UNSET:') !== false) {
             $_dname = str_replace('UNSET:', '', $dname);
             unset($responses[$_dname]);
             continue;
         }
         /**
          * [DATA:name]
          * 把之前[name]处理完的数据当作原始数据
          * 如果之前有数据会叠加
          * 用于数据多次处理
          * @var string
          */
         if (strpos($dname, 'DATA:') !== false) {
             $_dname = str_replace('DATA:', '', $dname);
             $content_html = $responses[$_dname];
             unset($responses[$dname]);
         }
         /**
          * [PRE:name]
          * 把PRE:name采集到的数据 当做原始数据
          * 一般用于下载内容
          * @var string
          */
         $pre_dname = 'PRE:' . $dname;
         if (isset($responses[$pre_dname])) {
             $content_html = $responses[$pre_dname];
             unset($responses[$pre_dname]);
         }
         /**
          * [EMPTY:name]
          * 如果[name]之前抓取结果数据为空使用这个数据项替换
          * @var string
          */
         if (strpos($dname, 'EMPTY:') !== false) {
             $_dname = str_replace('EMPTY:', '', $dname);
             if (empty($responses[$_dname])) {
                 $dname = $_dname;
             } else {
                 //有值不执行抓取
                 continue;
             }
         }
         $content = spiderContent::crawl($content_html, $data, $rule, $responses);
         unset($content_html);
         if (strpos($dname, 'ARRAY:') !== false) {
             // if(strpos($data['rule'], 'RULE@')!==false){
             $dname = str_replace('ARRAY:', '', $dname);
             // $contentArray = $responses[$dname];
             // // $contentArray = $responses[$dname];
             $cArray = array();
             foreach ((array) $content as $k => $value) {
                 foreach ((array) $value as $key => $val) {
                     $cArray[$key][$k] = $val;
                 }
             }
             if ($cArray) {
                 $content = $cArray;
                 unset($cArray);
             }
         }
         /**
          * [name.xxx]
          * 采集内容做为数组
          */
         if (strpos($dname, '.') !== false) {
             $f_key = substr($dname, 0, stripos($dname, "."));
             $s_key = substr(strrchr($dname, "."), 1);
             if (isset($responses[$f_key][$s_key])) {
                 if (is_array($responses[$f_key][$s_key])) {
                     $responses[$f_key][$s_key] = array_merge($responses[$f_key][$s_key], $content);
                 } else {
                     $responses[$f_key][$s_key] .= $content;
                 }
             } else {
                 $responses[$f_key][$s_key] = $content;
             }
         } else {
             /**
              * 多个name 内容合并
              */
             if (isset($responses[$dname])) {
                 if (is_array($responses[$dname])) {
                     $responses[$dname] = array_merge($responses[$dname], $content);
                 } else {
                     $responses[$dname] .= $content;
                 }
             } else {
                 $responses[$dname] = $content;
             }
         }
         /**
          * 对匹配多条的数据去重过滤
          */
         if (!is_array($responses[$dname]) && $data['multi']) {
             if (strpos($responses[$dname], ',') !== false) {
                 $_dnameArray = explode(',', $responses[$dname]);
                 $dnameArray = array();
                 foreach ((array) $_dnameArray as $key => $value) {
                     $value = trim($value);
                     $value && ($dnameArray[] = $value);
                 }
                 $dnameArray = array_filter($dnameArray);
                 $dnameArray = array_unique($dnameArray);
                 $responses[$dname] = implode(',', $dnameArray);
                 unset($dnameArray, $_dnameArray);
             }
         }
         gc_collect_cycles();
     }
     if (isset($responses['title']) && empty($responses['title'])) {
         $responses['title'] = $responses['__title__'];
     }
     spider::$allHtml = null;
     unset($html);
     gc_collect_cycles();
     if (spider::$dataTest) {
         echo "<pre style='width:99%;word-wrap: break-word;'>";
         print_r(iS::escapeStr($responses));
         echo '<hr />';
         echo '使用内存:' . iFS::sizeUnit(memory_get_usage()) . ' 执行时间:' . iPHP::timer_stop() . 's';
         echo "</pre>";
     }
     iFS::$CURLOPT_ENCODING = '';
     iFS::$CURLOPT_REFERER = '';
     iFS::$watermark_config['pos'] = iCMS::$config['watermark']['pos'];
     iFS::$watermark_config['x'] = iCMS::$config['watermark']['x'];
     iFS::$watermark_config['y'] = iCMS::$config['watermark']['y'];
     iFS::$watermark_config['img'] = iCMS::$config['watermark']['img'];
     $rule['fs']['encoding'] && (iFS::$CURLOPT_ENCODING = $rule['fs']['encoding']);
     $rule['fs']['referer'] && (iFS::$CURLOPT_REFERER = $rule['fs']['referer']);
     if ($rule['watermark_mode']) {
         iFS::$watermark_config['pos'] = $rule['watermark']['pos'];
         iFS::$watermark_config['x'] = $rule['watermark']['x'];
         iFS::$watermark_config['y'] = $rule['watermark']['y'];
         $rule['watermark']['img'] && (iFS::$watermark_config['img'] = $rule['watermark']['img']);
     }
     if (spider::$callback['data'] && is_callable(spider::$callback['data'])) {
         $responses = call_user_func_array(spider::$callback['data'], array($responses));
     }
     return $responses;
 }
Exemple #25
0
 function do_save()
 {
     $id = (int) $_POST['id'];
     $uid = (int) $_POST['uid'];
     $rootid = (int) $_POST['rootid'];
     $cid = implode(',', (array) $_POST['cid']);
     $tcid = implode(',', (array) $_POST['tcid']);
     $pid = implode(',', (array) $_POST['pid']);
     $_cid = iS::escapeStr($_POST['_cid']);
     $_tcid = iS::escapeStr($_POST['_tcid']);
     $_pid = iS::escapeStr($_POST['_pid']);
     $name = iS::escapeStr($_POST['name']);
     $subtitle = iS::escapeStr($_POST['subtitle']);
     $tkey = iS::escapeStr($_POST['tkey']);
     $seotitle = iS::escapeStr($_POST['seotitle']);
     $keywords = iS::escapeStr($_POST['keywords']);
     $pic = iS::escapeStr($_POST['pic']);
     $bpic = iS::escapeStr($_POST['bpic']);
     $mpic = iS::escapeStr($_POST['mpic']);
     $spic = iS::escapeStr($_POST['spic']);
     $description = iS::escapeStr($_POST['description']);
     $url = iS::escapeStr($_POST['url']);
     $related = iS::escapeStr($_POST['related']);
     $tpl = iS::escapeStr($_POST['tpl']);
     $weight = _int($_POST['weight']);
     $ordernum = _int($_POST['ordernum']);
     $status = (int) $_POST['status'];
     $haspic = $pic ? '1' : '0';
     $pubdate = time();
     $metadata = $_POST['metadata'];
     $uid or $uid = iMember::$userid;
     if ($callback) {
         if (empty($name)) {
             echo '标签名称不能为空!';
             return false;
         }
     }
     $name or iPHP::alert('标签名称不能为空!');
     $cid or iPHP::alert('请选择标签所属栏目!');
     if ($metadata) {
         if ($metadata['key']) {
             $md = array();
             foreach ($metadata['key'] as $_mk => $_mval) {
                 !preg_match("/[a-zA-Z0-9_\\-]/", $_mval) && iPHP::alert($this->name_text . '附加属性名称只能由英文字母、数字或_-组成(不支持中文)');
                 $md[$_mval] = $metadata['value'][$_mk];
             }
         } else {
             $md = $metadata;
         }
         $metadata = addslashes(json_encode($md));
     }
     if (empty($id)) {
         $hasNameId = iDB::value("SELECT `id` FROM `#iCMS@__tags` where `name` = '{$name}'");
         if ($hasNameId) {
             if (isset($_POST['spider_update'])) {
                 $id = $hasNameId;
             } else {
                 iPHP::alert('该标签已经存在!请检查是否重复');
             }
         }
     }
     if (empty($tkey) && $url) {
         $tkey = substr(md5($url), 8, 16);
         $hasTkey = iDB::value("SELECT `id` FROM `#iCMS@__tags` where `tkey` = '{$tkey}'");
         if ($hasTkey) {
             if (isset($_POST['spider_check_tkey'])) {
                 echo '该自定义链接已经存在!请检查是否重复';
                 return false;
             } else {
                 iPHP::alert('该自定义链接已经存在!请检查是否重复');
             }
         }
     }
     $tkey or $tkey = strtolower(pinyin($name));
     iFS::$forceExt = "jpg";
     iFS::checkHttp($pic) && ($pic = iFS::http($pic));
     iFS::checkHttp($bpic) && ($bpic = iFS::http($bpic));
     iFS::checkHttp($mpic) && ($mpic = iFS::http($mpic));
     iFS::checkHttp($spic) && ($spic = iFS::http($spic));
     iPHP::import(iPHP_APP_CORE . '/iMAP.class.php');
     $fields = array('uid', 'rootid', 'cid', 'tcid', 'pid', 'tkey', 'name', 'seotitle', 'subtitle', 'keywords', 'description', 'metadata', 'haspic', 'pic', 'bpic', 'mpic', 'spic', 'url', 'related', 'count', 'weight', 'tpl', 'ordernum', 'pubdate', 'status');
     $data = compact($fields);
     if (empty($id)) {
         $data['postime'] = $pubdate;
         $data['count'] = '0';
         $data['comments'] = '0';
         $id = iDB::insert('tags', $data);
         tag::cache($id, 'id');
         map::init('prop', $this->appid);
         $pid && map::add($pid, $id);
         map::init('category', $this->appid);
         map::add($cid, $id);
         $tcid && map::add($tcid, $id);
         $msg = '标签添加完成';
     } else {
         if (isset($_POST['spider_update'])) {
             // $data = array();
             $hasTag = iDB::row("SELECT * FROM `#iCMS@__tags` where `id` = '{$id}'", ARRAY_A);
             $this->check_spider_data($data, $hasTag, 'subtitle', $subtitle);
             $this->check_spider_data($data, $hasTag, 'description', $description);
             $this->check_spider_data($data, $hasTag, 'seotitle', $seotitle);
             $this->check_spider_data($data, $hasTag, 'keywords', $keywords);
             $this->check_spider_data($data, $hasTag, 'related', $related);
             $hasTag['cid'] && $cid && ($data['cid'] = $cid);
             $_cid = $hasTag['cid'];
             $hasTag['tcid'] && $tcid && ($data['tcid'] = $tcid);
             $_tcid = $hasTag['tcid'];
             $hasTag['pid'] && $pid && ($data['pid'] = $pid);
             $_pid = $hasTag['pid'];
         }
         unset($data['count'], $data['comments']);
         iDB::update('tags', $data, array('id' => $id));
         tag::cache($id, 'id');
         map::init('prop', $this->appid);
         map::diff($pid, $_pid, $id);
         map::init('category', $this->appid);
         map::diff($cid, $_cid, $id);
         map::diff($tcid, $_tcid, $id);
         $msg = '标签更新完成';
     }
     iACP::callback($id, $this);
     if ($this->callback['code']) {
         return array("code" => $this->callback['code'], 'indexid' => $id);
     }
     iPHP::success($msg, "url:" . APP_URI);
 }
Exemple #26
0
    echo iFS::icon($filepath, './app/admincp/ui');
    ?>
</a>
                <a class="tip" title="<?php 
    echo $filepath;
    ?>
<hr />源文件名:<?php 
    echo $rs[$i]['ofilename'];
    ?>
"><?php 
    echo $rs[$i]['filename'] . '.' . $rs[$i]['ext'];
    ?>
</a>
              </td>
              <td><?php 
    echo iFS::sizeUnit($rs[$i]['size']);
    ?>
<br/><?php 
    echo get_date($rs[$i]['time'], 'Y-m-d');
    ?>
</td>
              <td>
                <a class="btn btn-small" href="<?php 
    echo $href;
    ?>
" data-toggle="modal" title="查看"><i class="fa fa-eye"></i> 查看</a>
                <?php 
    if (iACP::MP('FILE.EDIT')) {
        ?>
                <a class="btn btn-small" href="<?php 
        echo APP_FURI;
Exemple #27
0
 public static function run()
 {
     $updateFile = iPATH . 'update.' . self::$release . '.php';
     if (iFS::ex($updateFile)) {
         require $updateFile;
         $msg = '执行升级程序<iCMS>';
         $msg .= updatePatch();
         $msg .= '升级顺利完成!<iCMS>删除升级程序!';
         iFS::del($updateFile);
     } else {
         $msg = '升级顺利完成!';
     }
     return $msg;
 }
Exemple #28
0
 public static function url_complement($baseUrl, $href)
 {
     $href = trim($href);
     if (stripos($href, 'http://') === false) {
         if ($href[0] == '/') {
             $base_uri = parse_url($baseUrl);
             $base_host = $base_uri['scheme'] . '://' . $base_uri['host'];
             return $base_host . '/' . ltrim($href, '/');
         } else {
             if (substr($baseUrl, -1) != '/') {
                 $info = pathinfo($baseUrl);
                 $info['extension'] && ($baseUrl = $info['dirname']);
             }
             $baseUrl = rtrim($baseUrl, '/');
             return iFS::path($baseUrl . '/' . ltrim($href, '/'));
         }
     } else {
         return $href;
     }
 }
Exemple #29
0
 public static function del_text($id, $page = 1)
 {
     iFS::rmdir(iPATH . '/' . self::get_text_dir($id) . '/');
 }
Exemple #30
0
    ?>
</td>
            <td><?php 
    echo $rs[$i]['Rows'];
    ?>
</td>
            <td><?php 
    echo iFS::sizeUnit($rs[$i]['Data_length']);
    ?>
</td>
            <td><?php 
    echo iFS::sizeUnit($rs[$i]['Index_length']);
    ?>
</td>
            <td><?php 
    echo iFS::sizeUnit($rs[$i]['Data_length'] + $rs[$i]['Index_length']);
    ?>
</td>
            <td><?php 
    echo $rs[$i]['Create_time'];
    ?>
</td>
            <td><?php 
    echo $rs[$i]['Update_time'];
    ?>
</td>
            <td><?php 
    echo $rs[$i]['Collation'];
    ?>
</td>
            <td><?php