Example #1
0
            unset($row);
            $pubdate = strftime("%y-%m-%d %H:%M:%S", $pubdate);
            if ($arcrank != 0) {
                exit;
            }
            $title = ConvertStr($title);
            $body = html2wml($body);
            if ($ishidden == 1) {
                exit;
            }
            //当前栏目下级分类
            $dsql->SetQuery("Select id,typename From `#@__arctype` where reid='{$typeid}' And channeltype=1 And ishidden=0 order by sortrank");
            $dsql->Execute();
            while ($row = $dsql->GetObject()) {
                $channellistnext .= "<a href='wap.php?action=list&amp;id={$row->id}'>" . ConvertStr($row->typename) . "</a> ";
            }
            //栏目内容(分页输出)
            include $cfg_templets_dir . "/wap/article.wml";
            $dsql->Close();
            echo $pageBody;
            exit;
        } else {
            ConvertCharset($varlist);
            include $cfg_templets_dir . "/wap/error.wml";
            $dsql->Close();
            ConvertCharset($varlist);
            echo $pageBody;
            exit;
        }
    }
}
Example #2
0
function ConvertCharset($mixed, $sourceCharset = 'ISO-8859-1', $destCharset = 'UTF-8')
{
    if (is_array($mixed)) {
        foreach ($mixed as $key => $value) {
            if (is_array($value)) {
                $mixed[$key] = ConvertCharset($value, $sourceCharset, $destCharset);
            } else {
                if (is_string($value)) {
                    $mixed[$key] = ConvertCharset($value, $sourceCharset, $destCharset);
                }
            }
        }
    } else {
        $mixed = html_entity_decode(htmlentities($mixed, ENT_NOQUOTES, $sourceCharset), ENT_NOQUOTES, $destCharset);
        if ($destCharset == 'ISO-8859-1') {
            $mixed = str_replace('&euro;', '�', $mixed);
        }
        if ($destCharset == 'UTF-8') {
            $mixed = str_replace('&euro;', chr(226) . chr(130) . chr(172), $mixed);
        }
    }
    return $mixed;
}