示例#1
0
文件: blogdetail.php 项目: cwcw/cms
/*
	[SupeSite] (C) 2007-2009 Comsenz Inc.
	$Id: blogdetail.php 11779 2009-03-25 02:48:38Z zhanglijun $
*/
if (!defined('IN_SUPESITE')) {
    exit('Access Denied');
}
$uid = intval($_SGET['uid']);
$id = intval($_SGET['id']);
$blogdetail = $blogcomment = array();
if (!empty($_SCONFIG['htmlblogdetail'])) {
    $_SHTML['action'] = 'blogdetail';
    if (!empty($_SGET['page'])) {
        $_SHTML['page'] = $_SGET['page'];
    }
    $_SGLOBAL['htmlfile'] = gethtmlfile($_SHTML);
    ehtml('get', $_SCONFIG['htmlblogdetailtime']);
    $_SCONFIG['debug'] = 0;
}
if (!empty($uid) && !empty($id)) {
    dbconnect(2);
    $query = $_SGLOBAL['db_uch']->query("SELECT bf.*, b.* FROM " . tname('blog', '2') . ' b LEFT JOIN ' . tname('blogfield', '2') . " bf ON bf.blogid=b.blogid WHERE b.blogid='{$id}' AND friend = 0");
    $blogdetail = $_SGLOBAL['db_uch']->fetch_array($query);
    if (empty($blogdetail)) {
        showmessage('blog_no_info');
    }
    $blogdetail['message'] = preg_replace_callback("/src\\=(.{1})([^\\>\\s]{10,105})\\.(jpg|gif|png)/i", 'addurlhttp', $blogdetail['message']);
    $cquery = $_SGLOBAL['db_uch']->query("SELECT * FROM " . tname('comment', '2') . " WHERE id='{$id}' AND idtype='blogid' ORDER BY dateline DESC LIMIT 10");
    while ($value = $_SGLOBAL['db_uch']->fetch_array($cquery)) {
        $value['message'] = preg_replace("/\\<img.+src=\"(.*)\" class=\"face\"\\>/isUme", "atturl('\\1')", $value['message']);
        $blogcomment[] = $value;
示例#2
0
function geturl($pstring, $urlmode = 0)
{
    global $_SGLOBAL, $_SCONFIG, $spaceself;
    //Éú³ÉHTML
    if (defined('CREATEHTML')) {
        $theurl = gethtmlurl($pstring);
        if (!empty($theurl)) {
            return $theurl;
        }
    }
    //URL»º´æ
    $cachekey = $pstring . $urlmode;
    if (empty($_SGLOBAL['url_cache'])) {
        $_SGLOBAL['url_cache'] = array();
    }
    if (!empty($_SGLOBAL['url_cache'][$cachekey])) {
        return $_SGLOBAL['url_cache'][$cachekey];
    }
    //url½á¹û
    $theurl = '';
    //Ç¿ÖÆphpģʽ
    $isphp = !empty($spaceself) ? 1 : strexists($pstring, 'php/1');
    //Ê×Ò³Á´½Ó
    if ($pstring == 'action/index') {
        $pstring = '';
    }
    //ËÑË÷ÓѺÃģʽ
    if (!empty($_SCONFIG['htmlmode']) && $_SCONFIG['htmlmode'] == 2 && !$isphp && $urlmode != 1) {
        $htmlarr = array('uid' => '', 'action' => '', 'catid' => '', 'fid' => '', 'tagid' => '', 'itemid' => '', 'tid' => '', 'type' => '', 'view' => '', 'mode' => '', 'showpro' => '', 'itemtypeid' => '', 'page' => '');
        $sarr = explode('/', $pstring);
        if (empty($sarr)) {
            $sarr = array('action' => 'index');
        }
        $htmlurlcheck = true;
        for ($i = 0; $i < count($sarr); $i = $i + 2) {
            if (!empty($sarr[$i + 1])) {
                if (key_exists($sarr[$i], $htmlarr)) {
                    $htmlarr[$sarr[$i]] = addslashes(str_replace(array('/', '\\'), '', rawurldecode(stripslashes($sarr[$i + 1]))));
                } else {
                    $htmlurlcheck = false;
                    break;
                }
            }
        }
        if ($htmlurlcheck) {
            $htmls = gethtmlfile($htmlarr);
            if (file_exists($htmls['path'])) {
                $theurl = $htmls['url'];
            }
        }
    }
    //ÆÕͨģʽ
    if (empty($theurl)) {
        if (empty($pstring)) {
            if ($urlmode == 1) {
                $theurl = S_URL_ALL;
            } else {
                $theurl = S_URL;
            }
        } else {
            $pre = '';
            $para = str_replace('/', '-', $pstring);
            if ($isphp || defined('S_ISPHP')) {
                $pre = '/index.php?';
            } else {
                if ($_SCONFIG['urltype'] == 5) {
                    $pre = '/index.php/';
                } else {
                    $pre = '/?';
                }
            }
            if (empty($para)) {
                $pre = '/';
            }
            if ($urlmode == 1) {
                //È«²¿Â·¾¶
                $theurl = S_URL_ALL . $pre . $para;
            } elseif ($urlmode == 2) {
                //´¦Àí
                $theurl = S_URL . $pre . $para;
                $theurl = url_remake($theurl);
            } else {
                //³£¹æ
                $theurl = S_URL . $pre . $para;
            }
        }
    }
    //url»º´æ
    $_SGLOBAL['url_cache'][$cachekey] = $theurl;
    return $theurl;
}