Esempio n. 1
0
function user_data($vars = null)
{
    $vars['uid'] or iPHP::warning('iCMS:user:data 标签出错! 缺少"uid"属性或"uid"值为空.');
    $uid = $vars['uid'];
    if ($uid == 'me') {
        $uid = 0;
        $auth = user::get_cookie();
        $auth && ($uid = user::$userid);
    }
    if (strpos($uid, ',') === false) {
        $user = (array) user::get($uid);
        if ($vars['data']) {
            $user += (array) user::data($uid);
        }
    } else {
        $uid_array = explode(',', $uid);
        foreach ($uid_array as $key => $value) {
            $user[$key] = (array) user::get($uid);
            if ($vars['data']) {
                $user[$key] += (array) user::data($uid);
            }
        }
    }
    return $user[0] === false ? false : (array) $user;
}
Esempio n. 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 marker_html($vars)
{
    $where_sql = "WHERE `status`='1'";
    $vars['key'] or iPHP::warning('iCMS&#x3a;marker&#x3a;html 标签出错! 缺少"key"属性或"key"值为空.');
    if (isset($vars['cid']) && $vars['cid'] != '') {
        $where_sql .= " AND `cid`='{$vars['cid']}'";
    }
    if (isset($vars['pid']) && $vars['pid'] != '') {
        $where_sql .= " AND `pid`='{$vars['pid']}'";
    }
    if (isset($vars['key']) && $vars['key'] != '') {
        $where_sql .= " AND `key`='{$vars['key']}'";
    }
    if (isset($vars['id']) && $vars['id'] != '') {
        $where_sql .= " AND `id`='{$vars['id']}'";
    }
    $marker = iDB::row("SELECT * FROM `#iCMS@__marker` {$where_sql}", ARRAY_A);
    iPHP_SQL_DEBUG && iDB::debug(1);
    if ($marker) {
        echo $marker['data'];
    }
}
Esempio n. 3
0
 public static function tpl_block_cache($vars, $content, &$tpl)
 {
     $vars['id'] or iPHP::warning('cache 标签出错! 缺少"id"属性或"id"值为空.');
     $cache_time = isset($vars['time']) ? (int) $vars['time'] : -1;
     $cache_name = iPHP_DEVICE . '/part/' . $vars['id'];
     $cache = iCache::get($cache_name);
     if (empty($cache)) {
         if ($content === null) {
             return false;
         }
         $cache = $content;
         iCache::set($cache_name, $content, $cache_time);
         unset($content);
     }
     if ($vars['assign']) {
         $tpl->assign($vars['assign'], $cache);
         return;
     }
     if ($content === null) {
         return $cache;
     }
     // return $cache;
 }
Esempio n. 4
0
function comment_form($vars)
{
    if (!iCMS::$hooks['enable_comment']) {
        iPHP::warning('此页面禁止调用 iCMS&#x3a;comment&#x3a;form 标签!');
    }
    if ($vars['ref']) {
        $_vars = iCMS::app_ref($vars['ref']);
        unset($vars['ref']);
        $vars = array_merge($vars, $_vars);
    }
    $vars['iid'] or iPHP::warning('iCMS&#x3a;comment&#x3a;form 标签出错! 缺少"iid"属性或"iid"值为空.');
    $vars['cid'] or iPHP::warning('iCMS&#x3a;comment&#x3a;form 标签出错! 缺少"cid"属性或"cid"值为空.');
    $vars['appid'] or iPHP::warning('iCMS&#x3a;comment&#x3a;form 标签出错! 缺少"appid"属性或"appid"值为空.');
    $vars['title'] or iPHP::warning('iCMS&#x3a;comment&#x3a;form 标签出错! 缺少"title"属性或"title"值为空.');
    switch ($vars['display']) {
        case 'iframe':
            $tpl = 'form.iframe';
            $vars['do'] = 'form';
            break;
        default:
            isset($vars['_display']) && ($vars['display'] = $vars['_display']);
            $vars['param'] = array('suid' => $vars['suid'], 'iid' => $vars['iid'], 'cid' => $vars['cid'], 'appid' => $vars['appid'], 'title' => $vars['title']);
            $tpl = 'form.default';
            break;
    }
    unset($vars['method'], $vars['_display']);
    $vars['query'] = http_build_query($vars);
    iPHP::assign('comment_vars', $vars);
    echo iPHP::view('iCMS://comment/' . $tpl . '.htm');
}
Esempio n. 5
0
function article_data($vars)
{
    $vars['aid'] or iPHP::warning('iCMS&#x3a;article&#x3a;data 标签出错! 缺少"aid"属性或"aid"值为空.');
    $data = iDB::row("SELECT body,subtitle FROM `#iCMS@__article_data` WHERE aid='" . (int) $vars['aid'] . "' LIMIT 1;", ARRAY_A);
    if ($data['body']) {
        $articleApp = iPHP::app("article");
        $data['body'] = $articleApp->ubb($data['body']);
        if (strpos($data['body'], '#--iCMS.Markdown--#') !== false) {
            $data['body'] = iPHP::Markdown($data['body']);
        }
        $data['body'] = $articleApp->keywords($data['body']);
        $data['body'] = $articleApp->taoke($data['body']);
    }
    return $data;
}